File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -2,17 +2,17 @@ package cmd
22
33import (
44 "os"
5+ "runtime/debug"
56
67 "github.com/spf13/cobra"
78)
89
910var version string
1011
1112var rootCmd = & cobra.Command {
12- Use : "clive" ,
13- Version : version ,
14- Short : "Automates terminal operations and lets you view them live via a browser" ,
15- Long : "Automates terminal operations and lets you view them live via a browser." ,
13+ Use : "clive" ,
14+ Short : "Automates terminal operations and lets you view them live via a browser" ,
15+ Long : "Automates terminal operations and lets you view them live via a browser." ,
1616}
1717
1818func Execute () {
@@ -21,3 +21,13 @@ func Execute() {
2121 os .Exit (1 )
2222 }
2323}
24+
25+ func init () {
26+ if version == "" {
27+ if info , ok := debug .ReadBuildInfo (); ok {
28+ version = info .Main .Version
29+ }
30+ }
31+
32+ rootCmd .Version = version
33+ }
You can’t perform that action at this time.
0 commit comments