public CommandGroup() { if (!typeof(TCommandType).GetTypeInfo().IsEnum) { throw new NotSupportedException(); } _options = new CommandGroupOptions(); }
/// <summary> /// Basic constructor. /// </summary> /// <param name="options">Options.</param> public CommandGroup(CommandGroupOptions options) { if (!typeof(TCommandType).GetTypeInfo().IsEnum) { throw new NotSupportedException(); } _options = options?.DeepClone() ?? new CommandGroupOptions(); }
private void DisplayCommandHelp(Action <ColoredMultistring> outputHandler, IEnumerable <string> tokens) { if (outputHandler == null) { return; } var groupOptions = new CommandGroupOptions { ServiceConfigurer = _parserOptions.ServiceConfigurer }; var group = new CommandGroup <TCommandType>(groupOptions); var parser = new ArgumentSetParser(CreateArgSet(), _parserOptions.With().Quiet()); parser.ParseTokens(tokens, group); var info = CommandLineParser.GetUsageInfo( parser.ArgumentSet, _parserOptions.HelpOptions, group); outputHandler(info); }
/// <summary> /// Basic constructor. /// </summary> /// <param name="options">Command group options.</param> /// <param name="selection">The selected command type.</param> /// <param name="parentObject">Optionally provides a reference to the /// object containing this command group.</param> public CommandGroup(CommandGroupOptions options, object selection, object parentObject) : this(options) { _parentObject = parentObject; SelectedCommand = selection; }