Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Apr 28, 2020. It is now read-only.

Commit a01aa56

Browse files
teddy-codesammario
authored andcommitted
Added version flag (#169)
1 parent 9d35204 commit a01aa56

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ func (r rootCmd) Subcommands() []cli.Command {
6666
&rmcmd{gf: &r.globalFlags},
6767
&proxycmd{},
6868
&chromeExtInstall{},
69+
&versioncmd{},
6970
}
7071
}
7172

versionmd.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package main
2+
3+
import (
4+
"flag"
5+
"fmt"
6+
7+
"go.coder.com/cli"
8+
)
9+
10+
var version string
11+
12+
type versioncmd struct {}
13+
14+
func (v *versioncmd) Spec() cli.CommandSpec {
15+
return cli.CommandSpec{
16+
Name: "version",
17+
Desc: fmt.Sprintf("Retrieve the current version."),
18+
}
19+
}
20+
21+
func (v *versioncmd) Run(fl *flag.FlagSet) {
22+
fmt.Println(version)
23+
}

0 commit comments

Comments
 (0)