github.com/haraldrudell/parl@v0.4.176/pflags/option-values.go (about)

     1  /*
     2  © 2020–present Harald Rudell <harald.rudell@gmail.com> (https://haraldrudell.github.io/haraldrudell/)
     3  ISC License
     4  */
     5  
     6  package pflags
     7  
     8  import "fmt"
     9  
    10  // OptionValues returns a printable map of current values
    11  //   - %v: map[debug:false …]
    12  func OptionValues(optionData []OptionData) (effectiveValueMap, defaultsMap map[string]string) {
    13  	effectiveValueMap = make(map[string]string, len(optionData))
    14  	defaultsMap = make(map[string]string, len(optionData))
    15  	for _, o := range optionData {
    16  		effectiveValueMap[o.Name] = o.ValueDump()
    17  		defaultsMap[o.Name] = fmt.Sprintf("%v", o.Value)
    18  	}
    19  	return
    20  }