Debian Codegraph @

bool.go

raw symbols SCIP
1 // Copyright 2013 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
5 package getoptscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/
6
7 import (
8 "fmtscip-go gomod github.com/golang/go/src go1.13 fmt/"
9 "stringsscip-go gomod github.com/golang/go/src go1.13 strings/"
10 )
11
12 type boolValuescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/boolValue# bool
13
14 func (b *boolValuescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/boolValue#) Setscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/boolValue#Set().(value string, opt Optionscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/Option#) error {
15 switch stringsscip-go gomod github.com/golang/go/src go1.13 strings/.ToLowerscip-go gomod github.com/golang/go/src go1.13 strings/ToLower().(value) {
16 case "", "1", "true", "on", "t":
17 *b = true
18 case "0", "false", "off", "f":
19 *b = false
20 default:
21 return fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("invalid value for bool %s: %q", opt.Namescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/Option#Name.(), value)
22 }
23 return nil
24 }
25
26 func (b *boolValuescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/boolValue#) Stringscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/boolValue#String().() string {
27 if *b {
28 return "true"
29 }
30 return "false"
31 }
32
33 // Bool creates a flag option that is a bool. Bools normally do not take a
34 // value however one can be assigned by using the long form of the option:
35 //
36 // --option=true
37 // --o=false
38 //
39 // Its value is case insensitive and one of true, false, t, f, on, off, t and 0.
40 func Boolscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/Bool().(name rune, helpvalue ...string) *bool {
41 return CommandLinescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/CommandLine..Boolscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/Set#Bool().(name, helpvalue...)
42 }
43
44 func (s *Setscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/Set#) Boolscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/Set#Bool().(name rune, helpvalue ...string) *bool {
45 var p bool
46 s.BoolVarLongscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/Set#BoolVarLong().(&p, "", name, helpvalue...)
47 return &p
48 }
49
50 func BoolLongscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/BoolLong().(name string, short rune, helpvalue ...string) *bool {
51 return CommandLinescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/CommandLine..BoolLongscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/Set#BoolLong().(name, short, helpvalue...)
52 }
53
54 func (s *Setscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/Set#) BoolLongscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/Set#BoolLong().(name string, short rune, helpvalue ...string) *bool {
55 var p bool
56 s.BoolVarLongscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/Set#BoolVarLong().(&p, name, short, helpvalue...)
57 return &p
58 }
59
60 func BoolVarscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/BoolVar().(p *bool, name rune, helpvalue ...string) Optionscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/Option# {
61 return CommandLinescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/CommandLine..BoolVarscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/Set#BoolVar().(p, name, helpvalue...)
62 }
63
64 func (s *Setscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/Set#) BoolVarscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/Set#BoolVar().(p *bool, name rune, helpvalue ...string) Optionscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/Option# {
65 return s.BoolVarLongscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/Set#BoolVarLong().(p, "", name, helpvalue...)
66 }
67
68 func BoolVarLongscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/BoolVarLong().(p *bool, name string, short rune, helpvalue ...string) Optionscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/Option# {
69 return CommandLinescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/CommandLine..BoolVarLongscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/Set#BoolVarLong().(p, name, short, helpvalue...)
70 }
71
72 func (s *Setscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/Set#) BoolVarLongscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/Set#BoolVarLong().(p *bool, name string, short rune, helpvalue ...string) Optionscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/Option# {
73 return s.VarLongscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/Set#VarLong().((*boolValuescip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/boolValue#)(p), name, short, helpvalue...).SetFlagscip-go gomod github.com/pborman/getopt . `github.com/pborman/getopt`/Option#SetFlag.()
74 }