code: func methodUsageText(rtp reflect.Type, defaults map[int]reflect.Value, method string) string {
  	// Generate the individual usage for each field in the command.  Several
  	// simplifying assumptions are made here because the RegisterCmd
  	// function has already rigorously enforced the layout.
  	rt := rtp.Elem()
  	numFields := rt.NumField()
  	reqFieldUsages := make([]string, 0, numFields)
  	optFieldUsages := make([]string, 0, numFields)
  	for i := 0; i < numFields; i++ {
  		rtf := rt.Field(i)
  		var isOptional bool
  		if kind := rtf.Type.Kind(); kind == reflect.Ptr {
  			isOptional = true
  		}
  
  		var defaultVal *reflect.Value
  		if defVal, ok := defaults[i]; ok {
  			defaultVal = &defVal
  		}
  
  		// Add human-readable usage to the appropriate slice that is
  		// later used to generate the one-line usage.
  		usage := fieldUsage(rtf, defaultVal)
  		if isOptional {
  			optFieldUsages = append(optFieldUsages, usage)
  		} else {
  			reqFieldUsages = append(reqFieldUsages, usage)
  		}
  	}
  
  	// Generate and return the one-line usage string.
  	usageStr := method
  	if len(reqFieldUsages) > 0 {
  		usageStr += " " + strings.Join(reqFieldUsages, " ")
  	}
  	if len(optFieldUsages) > 0 {
  		usageStr += fmt.Sprintf(" (%s)", strings.Join(optFieldUsages, " "))
  	}
  	return usageStr
  }
docs: // methodUsageText returns a one-line usage string for the provided command and
  // method info.  This is the main work horse for the exported MethodUsageText
  // function.