// Get a list of all commands in a BaseCliCommands class
 public static List <Command> GetCommands(this BaseCliCommands baseCommands)
 {
     return(baseCommands.GetType().GetRuntimeMethods()
            .Where(method => method.GetCommandDefinition() != null)
            .Select(method => new Command(baseCommands, method))
            .ToList());
 }
Beispiel #2
0
        internal CommandModel(BaseCliCommands cliCommands)
        {
            CliCommands    = cliCommands;
            Commands       = cliCommands.GetCommands();
            DefaultCommand = GetDefaultCommandOrNull(Commands);
            HelpFacade     = new HelpFacade(cliCommands);

            ValidateNoDuplicateNames(Commands);
            ValidateMethodArguments(Commands);
        }
 internal BaseCommand(BaseCliCommands parent, MethodInfo method)
 {
     Parent = parent;
     Method = method;
 }
 internal Command(BaseCliCommands parent, MethodInfo method) : base(parent, method)
 {
     Definition = method.GetCommandDefinition();
     Default    = method.HasDefaultCommandAttribute();
 }