diff options
Diffstat (limited to 'vendor/github.com/pborman/getopt/v2/duration.go')
-rw-r--r-- | vendor/github.com/pborman/getopt/v2/duration.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/vendor/github.com/pborman/getopt/v2/duration.go b/vendor/github.com/pborman/getopt/v2/duration.go new file mode 100644 index 0000000..7607815 --- /dev/null +++ b/vendor/github.com/pborman/getopt/v2/duration.go @@ -0,0 +1,28 @@ +// Copyright 2017 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package getopt + +import "time" + +// Duration creates an option that parses its value as a time.Duration. +func Duration(name rune, value time.Duration, helpvalue ...string) *time.Duration { + CommandLine.FlagLong(&value, "", name, helpvalue...) + return &value +} + +func (s *Set) Duration(name rune, value time.Duration, helpvalue ...string) *time.Duration { + s.FlagLong(&value, "", name, helpvalue...) + return &value +} + +func DurationLong(name string, short rune, value time.Duration, helpvalue ...string) *time.Duration { + CommandLine.FlagLong(&value, name, short, helpvalue...) + return &value +} + +func (s *Set) DurationLong(name string, short rune, value time.Duration, helpvalue ...string) *time.Duration { + s.FlagLong(&value, name, short, helpvalue...) + return &value +} |