code: func listCommands(commands map[string]cli.CommandFactory, maxKeyLen int) string {
  	var buf bytes.Buffer
  
  	// Get the list of keys so we can sort them, and also get the maximum
  	// key length so they can be aligned properly.
  	keys := make([]string, 0, len(commands))
  	for key, _ := range commands {
  		// This is an internal command that users should never call directly so
  		// we will hide it from the command listing.
  		if key == "internal-plugin" {
  			continue
  		}
  		keys = append(keys, key)
  	}
  	sort.Strings(keys)
  
  	for _, key := range keys {
  		commandFunc, ok := commands[key]
  		if !ok {
  			// This should never happen since we JUST built the list of
  			// keys.
  			panic("command not found: " + key)
  		}
  
  		command, err := commandFunc()
  		if err != nil {
  			log.Printf("[ERR] cli: Command '%s' failed to load: %s",
  				key, err)
  			continue
  		}
  
  		key = fmt.Sprintf("%s%s", key, strings.Repeat(" ", maxKeyLen-len(key)))
  		buf.WriteString(fmt.Sprintf("    %s    %s\n", key, command.Synopsis()))
  	}
  
  	return buf.String()
  }
docs: // listCommands just lists the commands in the map with the
  // given maximum key length.