Add 'version' command

This commit is contained in:
Manfred Touron 2017-11-01 22:09:08 +01:00
parent 2876f9f947
commit a08c4519cd
2 changed files with 10 additions and 0 deletions

View file

@ -15,10 +15,13 @@ import (
"github.com/urfave/cli"
)
var version = "0.0.1"
func main() {
app := cli.NewApp()
app.Name = path.Base(os.Args[0])
app.Author = "Manfred Touron"
app.Version = version
app.Email = "https://github.com/moul/sshportal"
app.Flags = []cli.Flag{
cli.StringFlag{

View file

@ -323,6 +323,13 @@ GLOBAL OPTIONS:
Action: func(c *cli.Context) error { return nil },
},
},
}, {
Name: "version",
Usage: "Show the SSHPortal version information",
Action: func(c *cli.Context) error {
fmt.Fprintf(s, "%s\n", version)
return nil
},
},
}