main: Error on arguments to version subcmd

This commit is contained in:
Anmol Sethi 2022-12-01 02:57:57 -08:00
parent fcb41107db
commit f7623a2057
No known key found for this signature in database
GPG key ID: 25BC68888A99A8BA

View file

@ -77,6 +77,9 @@ func run(ctx context.Context, ms *xmain.State) (err error) {
case "fmt":
return autofmt(ctx, ms)
case "version":
if len(ms.Opts.Flags.Args()) > 1 {
return xmain.UsageErrorf("version subcommand accepts no arguments")
}
fmt.Println(version.Version)
return nil
}