From e18d36ebae30536c77c61cd5da123991e0ca1629 Mon Sep 17 00:00:00 2001 From: Rasmus Dahlberg Date: Sun, 31 Dec 2023 09:39:25 +0100 Subject: Add drafty prototype --- internal/flagopt/flagopt.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 internal/flagopt/flagopt.go (limited to 'internal/flagopt') diff --git a/internal/flagopt/flagopt.go b/internal/flagopt/flagopt.go new file mode 100644 index 0000000..484270d --- /dev/null +++ b/internal/flagopt/flagopt.go @@ -0,0 +1,26 @@ +package flagopt + +import ( + "flag" + "time" +) + +func BoolOpt(fs *flag.FlagSet, opt *bool, short, long string, value bool) { + fs.BoolVar(opt, short, value, "") + fs.BoolVar(opt, long, value, "") +} + +func DurationOpt(fs *flag.FlagSet, opt *time.Duration, short, long string, value time.Duration) { + fs.DurationVar(opt, short, value, "") + fs.DurationVar(opt, long, value, "") +} + +func UintOpt(fs *flag.FlagSet, opt *uint, short, long string, value uint) { + fs.UintVar(opt, short, value, "") + fs.UintVar(opt, long, value, "") +} + +func StringOpt(fs *flag.FlagSet, opt *string, short, long, value string) { + fs.StringVar(opt, short, value, "") + fs.StringVar(opt, long, value, "") +} -- cgit v1.2.3