diff options
author | Rasmus Dahlberg <rasmus@rgdd.se> | 2023-03-18 13:48:41 +0100 |
---|---|---|
committer | Rasmus Dahlberg <rasmus@rgdd.se> | 2023-03-18 13:48:41 +0100 |
commit | 52bd32914a6184ee4d403f8418eb0546074ac5bb (patch) | |
tree | 6cdd827fad634d4e5d1ce578f651e93910a75380 /internal | |
parent | 385c2e62d256961f1fc99c7a4d41cd01b426c837 (diff) |
Print metrics based on flag duration to stderr
Diffstat (limited to 'internal')
-rw-r--r-- | internal/ctflag/ctflag.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/internal/ctflag/ctflag.go b/internal/ctflag/ctflag.go index 1309afd..cf8d7db 100644 --- a/internal/ctflag/ctflag.go +++ b/internal/ctflag/ctflag.go @@ -31,6 +31,7 @@ package ctflag import ( "flag" "fmt" + "time" ) // NewFlagSet outputs a new flag set that continues on errors without standard @@ -77,6 +78,12 @@ func Uint64(fs *flag.FlagSet, opt *uint64, short, long string, value uint64) { fs.Uint64Var(opt, long, value, "") } +// Duration adds a new duration option to a flag set +func Duration(fs *flag.FlagSet, opt *time.Duration, short, long string, value time.Duration) { + fs.DurationVar(opt, short, value, "") + fs.DurationVar(opt, long, value, "") +} + // Bool adds a new bool option to a flag set func Bool(fs *flag.FlagSet, opt *bool, short, long string, value bool) { fs.BoolVar(opt, short, value, "") |