File tree Expand file tree Collapse file tree 3 files changed +35
-0
lines changed
Expand file tree Collapse file tree 3 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ func main() {
2424 commandAdmin (),
2525 commandServe (),
2626 commandServeWeb (),
27+ commandVersion (),
2728 )
2829
2930 err := app .Run (os .Args )
Original file line number Diff line number Diff line change 1+ package main
2+
3+ import (
4+ "fmt"
5+ "runtime/debug"
6+
7+ "github.com/urfave/cli/v2"
8+ )
9+
10+ func commandVersion () * cli.Command {
11+ return & cli.Command {
12+ Name : "version" ,
13+ Usage : "HashUp version" ,
14+ Flags : []cli.Flag {},
15+ Action : func (c * cli.Context ) error {
16+ if bi , ok := debug .ReadBuildInfo (); ok {
17+ fmt .Println (bi .Main .Version )
18+ }
19+ return nil
20+ },
21+ }
22+ }
Original file line number Diff line number Diff line change 44 "embed"
55 "fmt"
66 "os"
7+ "runtime/debug"
78
89 "github.com/urfave/cli/v2"
910)
@@ -168,6 +169,17 @@ func main() {
168169 return setupConfig (c .Bool ("force" ))
169170 },
170171 },
172+ {
173+ Name : "version" ,
174+ Usage : "HashUp version" ,
175+ Flags : []cli.Flag {},
176+ Action : func (c * cli.Context ) error {
177+ if bi , ok := debug .ReadBuildInfo (); ok {
178+ fmt .Println (bi .Main .Version )
179+ }
180+ return nil
181+ },
182+ },
171183 },
172184 }
173185
You can’t perform that action at this time.
0 commit comments