diff options
Diffstat (limited to 'command/flag.go')
| -rw-r--r-- | command/flag.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/command/flag.go b/command/flag.go index 5765dd0d..8e890a1a 100644 --- a/command/flag.go +++ b/command/flag.go @@ -28,6 +28,14 @@ func (v StringFlag) Define(b *strings.Builder, set *flag.FlagSet, p any, name, u b.WriteString(" [" + prettyFlag(name) + " <value>]") } +// IntFlag is the default value of an int flag. +type IntFlag int + +func (v IntFlag) Define(b *strings.Builder, set *flag.FlagSet, p any, name, usage string) { + set.IntVar(p.(*int), name, int(v), usage) + b.WriteString(" [" + prettyFlag(name) + " <int>]") +} + // BoolFlag is the default value of a bool flag. type BoolFlag bool |
