feat: provide short version (#1206)
Provides a short version output to assist with CLI parsing. --------- Co-authored-by: Alex Tocar <alex.tocar@ueuie.dev>
This commit is contained in:
parent
a48691fe78
commit
a665d3245a
|
@ -134,11 +134,22 @@ To determine if an update happened in a script, check for error code 11.`,
|
||||||
{
|
{
|
||||||
Name: "version",
|
Name: "version",
|
||||||
Action: func(c *cli.Context) (err error) {
|
Action: func(c *cli.Context) (err error) {
|
||||||
|
if c.Bool("short") {
|
||||||
|
fmt.Println(strings.Split(c.App.Version, " ")[0])
|
||||||
|
return nil
|
||||||
|
}
|
||||||
version(c)
|
version(c)
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Usage: versionText,
|
Usage: versionText,
|
||||||
Description: versionText,
|
Description: versionText,
|
||||||
|
Flags: []cli.Flag{
|
||||||
|
&cli.BoolFlag{
|
||||||
|
Name: "short",
|
||||||
|
Aliases: []string{"s"},
|
||||||
|
Usage: "print just the version number",
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
cmds = append(cmds, tunnel.Commands()...)
|
cmds = append(cmds, tunnel.Commands()...)
|
||||||
|
|
Loading…
Reference in New Issue