예제 #1
0
        public static CommandResult CommandHelp(string command, CommandLineProtoRegistry commands)
        {
            CommandResult result = new CommandResult();

            CommandLineProto[] protos = commands.Find(command);
            if (protos.Length == 0)
            {
                return(new CommandResult(false, "'{command}' is not a command"));
            }
            Usage u = CommandLineProto.GetUsage(protos);

            result.AddMessage(u.ToString());
            return(result);
        }
예제 #2
0
        public static CommandResult CommandHelp(CommandLine args, CommandLineProtoRegistry commands)
        {
            CommandResult    result = new CommandResult();
            CommandLineProto proto  = commands.Find(args);

            if (proto == null)
            {
                return(new CommandResult(false, "Command not found"));
            }
            Usage u = CommandLineProto.GetUsage(proto);

            result.AddMessage(u.ToString());
            return(result);
        }
예제 #3
0
        public static CommandResult GeneralHelp(CommandLineProtoRegistry commands)
        {
            CommandResult result = new CommandResult();

            result.AddMessage($"{ProgramInfo.GetProgramName()} {ProgramInfo.GetProgramVersion()}");
            result.AddMessage();
            var description = ProgramInfo.GetProgramDescription();

            if (!String.IsNullOrEmpty(description))
            {
                result.AddMessage(description);
                result.AddMessage();
            }
            CommandLineProto[] protos = commands.GetAll();
            Usage u = CommandLineProto.GetUsage(protos);

            result.AddMessage(u.ToString());
            return(result);
        }