public int GetArgumentIndex(string name) { if (!_argumentIndexes.TryGetValue(name, out var index)) { throw new Exception($"Unknown argument '{name}'"); } return(index); }
public void AddCommand(string name, Command command, CommandMetaData metaData = null) { if (_commands.TryGetValue(name, out var otherCommand)) { throw new Exception($"Cannot add command '{name}', it already exists: {otherCommand}"); } _commands.Add(name, command); _infos.Add(command, metaData ?? new CommandMetaData(null, null)); if (Debug) { UnityEngine.Debug.Log($"Added command: {command}"); } }