File tree 2 files changed +12
-0
lines changed
2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ type Config struct {
13
13
MulticastAddress string
14
14
WildcardAddress string
15
15
FilePath string
16
+ Version string
16
17
}
17
18
18
19
var G Config
@@ -31,6 +32,7 @@ func (c *Config) SetConf(port string) error {
31
32
c .MulticastAddress = fmt .Sprintf ("224.0.0.169:%s" , port )
32
33
c .WildcardAddress = fmt .Sprintf ("0.0.0.0:%s" , port )
33
34
c .FilePath = ""
35
+ c .Version = "0.2.0"
34
36
return nil
35
37
}
36
38
Original file line number Diff line number Diff line change @@ -77,8 +77,18 @@ func main() {
77
77
Aliases : []string {"p" },
78
78
Destination : & port ,
79
79
},
80
+ & cli.BoolFlag {
81
+ Name : "version" ,
82
+ Aliases : []string {"v" },
83
+ Usage : "print the version" ,
84
+ },
80
85
},
81
86
Action : func (c * cli.Context ) error {
87
+ if c .Bool ("version" ) {
88
+ fmt .Printf ("st version %s\n " , config .G .Version )
89
+ return nil
90
+ }
91
+
82
92
if c .NArg () > 0 {
83
93
currentPath := filepath .ToSlash (c .Args ().Get (0 ))
84
94
config .G .FilePath = currentPath
You can’t perform that action at this time.
0 commit comments