aboutsummaryrefslogtreecommitdiff
path: root/internal/flagopt/flagopt.go
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus@rgdd.se>2023-12-31 09:39:25 +0100
committerRasmus Dahlberg <rasmus@rgdd.se>2024-01-07 20:22:23 +0100
commite18d36ebae30536c77c61cd5da123991e0ca1629 (patch)
treebf4880c0019a6009ab1b671e23ef4a1a4a5e8e08 /internal/flagopt/flagopt.go
parent54d980afcbd6f0011d6a162e0003587d26a3e311 (diff)
Add drafty prototype
Diffstat (limited to 'internal/flagopt/flagopt.go')
-rw-r--r--internal/flagopt/flagopt.go26
1 files changed, 26 insertions, 0 deletions
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, "")
+}