Skip to content

Commit

Permalink
feat: provide short version (#1206)
Browse files Browse the repository at this point in the history
Provides a short version output to assist with CLI parsing.
---------

Co-authored-by: Alex Tocar <[email protected]>
  • Loading branch information
Alexandru Tocar and Alex Tocar authored Apr 2, 2024
1 parent a48691f commit a665d32
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cmd/cloudflared/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,22 @@ To determine if an update happened in a script, check for error code 11.`,
{
Name: "version",
Action: func(c *cli.Context) (err error) {
if c.Bool("short") {
fmt.Println(strings.Split(c.App.Version, " ")[0])
return nil
}
version(c)
return nil
},
Usage: versionText,
Description: versionText,
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "short",
Aliases: []string{"s"},
Usage: "print just the version number",
},
},
},
}
cmds = append(cmds, tunnel.Commands()...)
Expand Down

0 comments on commit a665d32

Please sign in to comment.