Retrieves the canonical command name corresponding to a given command ID.
planetcnc.cmd_get_name(cmd_id)
#! /usr/bin/env python import planetcnc def list_all_commands(): # Get the tuple of command names from the C module. cmds = planetcnc.cmd_list() if not isinstance(cmds, tuple): print("cmd_list did not return a tuple!") return # Enumerate over the tuple and call cmd_get_id for each command name. for name in cmds: try: cmd_id = planetcnc.cmd_get_id(name) cmd_name = planetcnc.cmd_get_name(cmd_id) cmd_displayname = planetcnc.cmd_get_displayname(cmd_id) print(f"Command '{name}', ID: {cmd_id}, Name: {cmd_name}, DisplayName: {cmd_displayname}") except Exception as e: print(f"Failed to get ID for command '{name}': {e}") list_all_commands()