github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/cf/flags/int.go (about)

     1  package flags
     2  
     3  import "strconv"
     4  
     5  type IntFlag struct {
     6  	Name      string
     7  	Value     int
     8  	Usage     string
     9  	ShortName string
    10  	Hidden    bool
    11  }
    12  
    13  func (f *IntFlag) Set(v string) {
    14  	i, _ := strconv.ParseInt(v, 10, 32)
    15  	f.Value = int(i)
    16  }
    17  
    18  func (f *IntFlag) String() string {
    19  	return f.Usage
    20  }
    21  
    22  func (f *IntFlag) GetName() string {
    23  	return f.Name
    24  }
    25  
    26  func (f *IntFlag) GetShortName() string {
    27  	return f.ShortName
    28  }
    29  
    30  func (f *IntFlag) GetValue() interface{} {
    31  	return f.Value
    32  }
    33  
    34  func (f *IntFlag) Visible() bool {
    35  	return !f.Hidden
    36  }
    37  
    38  func (f *IntFlag) SetVisibility(v bool) {
    39  	f.Hidden = !v
    40  }