public CommandTree CreateTree(RootCommand rootCommand) { var tree = new CommandTree(); foreach (var command in rootCommand.Commands) { var commandInstance = Resolve(command); var node = CreateNode(commandInstance); tree.Nodes.Add(node); if (node.MaxKeywordLength > tree.MaxKeywordLength) { tree.MaxKeywordLength = node.MaxKeywordLength; } if (node.MaxDescriptionLength > tree.MaxDescriptionLength) { tree.MaxDescriptionLength = node.MaxDescriptionLength; } } return(tree); }
public ConsoleEngine(RootCommand rootCommand, IResolver resolver, bool autoRegisterCommands) { _rootCommand = rootCommand; _resolver = resolver; _autoRegisterCommands = autoRegisterCommands; _rootCommand.Register <ExitCommand>(resolver); _rootCommand.Register <ClearCommand>(resolver); _rootCommand.Register <ClsCommand>(resolver); _commandTree = BuildTree(); }
public AutoCompletionHandler(CommandTree commandTree) { _commandTree = commandTree; }