protected override object OnExecute(CommandContext context) { if (context.Expression.Arguments.Length == 0) { throw new CommandException(Properties.Resources.Text_Message_MissingCommandArguments); } var result = new PluginTreeNode[context.Expression.Arguments.Length]; for (int i = 0; i < context.Expression.Arguments.Length; i++) { result[i] = _pluginTree.Find(context.Expression.Arguments[i]); if (result[i] == null) { context.Output.WriteLine(CommandOutletColor.DarkRed, string.Format(Properties.Resources.Text_Message_PluginNodeNotFound, context.Expression.Arguments[i])); } Utility.PrintPluginNode(context.Output, result[i], context.Expression.Options.GetValue <ObtainMode>("obtain"), context.Expression.Options.GetValue <int>("maxDepth")); } if (result.Length == 1) { return(result[0]); } return(result); }
protected override object OnExecute(CommandContext context) { if (!(context.Parameter is PluginTreeNode node)) { if (context.Parameter != null) { throw new CommandException(string.Format(Properties.Resources.Text_Message_InvalidCommandParameter, context.CommandNode.FullPath)); } if (context.Expression.Arguments.Length == 0) { throw new CommandException(Properties.Resources.Text_Message_MissingCommandArguments); } if (context.Expression.Arguments.Length > 1) { throw new CommandException(Properties.Resources.Text_Message_CommandArgumentsTooMany); } node = _pluginTree.Find(context.Expression.Arguments[0]); if (node == null) { context.Output.WriteLine(CommandOutletColor.DarkRed, string.Format(Properties.Resources.Text_Message_PluginNodeNotFound, context.Expression.Arguments[0])); return(null); } } this.WritePluginTree(context.Output, node, context.Expression.Options.GetValue <int>("depth"), 0, 0, context.Expression.Options.Contains("qualified")); return(node); }