code: func listCommands() {
  	const (
  		categoryChain uint8 = iota
  		categoryWallet
  		numCategories
  	)
  
  	// Get a list of registered commands and categorize and filter them.
  	cmdMethods := btcjson.RegisteredCmdMethods()
  	categorized := make([][]string, numCategories)
  	for _, method := range cmdMethods {
  		flags, err := btcjson.MethodUsageFlags(method)
  		if err != nil {
  			// This should never happen since the method was just
  			// returned from the package, but be safe.
  			continue
  		}
  
  		// Skip the commands that aren't usable from this utility.
  		if flags&unusableFlags != 0 {
  			continue
  		}
  
  		usage, err := btcjson.MethodUsageText(method)
  		if err != nil {
  			// This should never happen since the method was just
  			// returned from the package, but be safe.
  			continue
  		}
  
  		// Categorize the command based on the usage flags.
  		category := categoryChain
  		if flags&btcjson.UFWalletOnly != 0 {
  			category = categoryWallet
  		}
  		categorized[category] = append(categorized[category], usage)
  	}
  
  	// Display the command according to their categories.
  	categoryTitles := make([]string, numCategories)
  	categoryTitles[categoryChain] = "Chain Server Commands:"
  	categoryTitles[categoryWallet] = "Wallet Server Commands (--wallet):"
  	for category := uint8(0); category < numCategories; category++ {
  		fmt.Println(categoryTitles[category])
  		for _, usage := range categorized[category] {
  			fmt.Println(usage)
  		}
  		fmt.Println()
  	}
  }
docs: // listCommands categorizes and lists all of the usable commands along with
  // their one-line usage.