diff options
author | Slack Coder <slackcoder@server.ky> | 2022-03-11 13:08:24 -0500 |
---|---|---|
committer | Slack Coder <slackcoder@server.ky> | 2022-03-30 11:34:46 -0500 |
commit | 29589a24b13fb223b113e94eca2c4fff0e56a4d9 (patch) | |
tree | e1754d195463439ae2834cd502b170648e47cdb8 /vendor/github.com/pborman/getopt/v2/bool.go | |
download | pkgtools-go-29589a24b13fb223b113e94eca2c4fff0e56a4d9.tar.xz |
Initial commit
Diffstat (limited to 'vendor/github.com/pborman/getopt/v2/bool.go')
-rw-r--r-- | vendor/github.com/pborman/getopt/v2/bool.go | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/vendor/github.com/pborman/getopt/v2/bool.go b/vendor/github.com/pborman/getopt/v2/bool.go new file mode 100644 index 0000000..2899bee --- /dev/null +++ b/vendor/github.com/pborman/getopt/v2/bool.go @@ -0,0 +1,36 @@ +// 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 + +// Bool creates a flag option that is a bool. Bools normally do not take a +// value however one can be assigned by using the long form of the option: +// +// --option=true +// --o=false +// +// The value is case insensitive and one of true, false, t, f, on, off, t and 0. +func Bool(name rune, helpvalue ...string) *bool { + var b bool + CommandLine.Flag(&b, name, helpvalue...) + return &b +} + +func BoolLong(name string, short rune, helpvalue ...string) *bool { + var p bool + CommandLine.FlagLong(&p, name, short, helpvalue...) + return &p +} + +func (s *Set) Bool(name rune, helpvalue ...string) *bool { + var b bool + s.Flag(&b, name, helpvalue...) + return &b +} + +func (s *Set) BoolLong(name string, short rune, helpvalue ...string) *bool { + var p bool + s.FlagLong(&p, name, short, helpvalue...) + return &p +} |