1// Copyright 2017 Google Inc. All rights reserved. 2// Use of this source code is governed by a BSD-style 3// license that can be found in the LICENSE file. 4 5package getopt 6 7// Bool creates a flag option that is a bool. Bools normally do not take a 8// value however one can be assigned by using the long form of the option: 9// 10// --option=true 11// --o=false 12// 13// The value is case insensitive and one of true, false, t, f, on, off, t and 0. 14func Bool(name rune, helpvalue ...string) *bool { 15 var b bool 16 CommandLine.Flag(&b, name, helpvalue...) 17 return &b 18} 19 20func BoolLong(name string, short rune, helpvalue ...string) *bool { 21 var p bool 22 CommandLine.FlagLong(&p, name, short, helpvalue...) 23 return &p 24} 25 26func (s *Set) Bool(name rune, helpvalue ...string) *bool { 27 var b bool 28 s.Flag(&b, name, helpvalue...) 29 return &b 30} 31 32func (s *Set) BoolLong(name string, short rune, helpvalue ...string) *bool { 33 var p bool 34 s.FlagLong(&p, name, short, helpvalue...) 35 return &p 36} 37