File tree 2 files changed +34
-3
lines changed
2 files changed +34
-3
lines changed Original file line number Diff line number Diff line change @@ -4,13 +4,16 @@ import (
4
4
"github.com/spf13/pflag"
5
5
"go.coder.com/cli"
6
6
"log"
7
- "os"
8
7
"net/http"
9
8
_ "net/http/pprof"
9
+ "os"
10
10
)
11
11
12
- type rootCmd struct {
13
- }
12
+ var (
13
+ version string
14
+ )
15
+
16
+ type rootCmd struct {}
14
17
15
18
func (r * rootCmd ) Run (fl * pflag.FlagSet ) {
16
19
fl .Usage ()
@@ -32,6 +35,7 @@ func (r *rootCmd) Subcommands() []cli.Command {
32
35
& shellCmd {},
33
36
& syncCmd {},
34
37
& urlCmd {},
38
+ & versionCmd {},
35
39
}
36
40
}
37
41
Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ "fmt"
5
+ "runtime"
6
+
7
+ "github.com/spf13/pflag"
8
+ "go.coder.com/cli"
9
+ )
10
+
11
+ type versionCmd struct {}
12
+
13
+ func (versionCmd ) Spec () cli.CommandSpec {
14
+ return cli.CommandSpec {
15
+ Name : "version" ,
16
+ Usage : "" ,
17
+ Desc : "Print the currently installed CLI version" ,
18
+ }
19
+ }
20
+
21
+ func (versionCmd ) Run (fl * pflag.FlagSet ) {
22
+ fmt .Println (
23
+ version ,
24
+ runtime .Version (),
25
+ runtime .GOOS + "/" + runtime .GOARCH ,
26
+ )
27
+ }
You can’t perform that action at this time.
0 commit comments