diff options
Diffstat (limited to 'internal')
-rw-r--r-- | internal/options/options.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/internal/options/options.go b/internal/options/options.go index 8e4ab0c..d6cbd70 100644 --- a/internal/options/options.go +++ b/internal/options/options.go @@ -3,6 +3,7 @@ package options import ( "flag" "fmt" + "time" ) const ( @@ -42,6 +43,12 @@ func AddUint64(fs *flag.FlagSet, opt *uint64, short, long string, value uint64) fs.Uint64Var(opt, long, value, "") } +// AddDuration adds a duration option to a flag set +func AddDuration(fs *flag.FlagSet, opt *time.Duration, short, long string, value time.Duration) { + fs.DurationVar(opt, short, value, "") + fs.DurationVar(opt, long, value, "") +} + // CheckString checks that a string option has a non-default value func CheckString(optionName, value string, err error) error { if err != nil { |