Esempio n. 1
0
        internal static void ShowHelp()
        {
            Console.WriteLine("usage: BehaveN.Tool COMMAND [ARGS]");
            Console.WriteLine();
            Console.WriteLine("The available commands are:");

            var commandTypes = CommandHelpers.GetCommandTypes();

            foreach (var commandType in commandTypes)
            {
                string name = commandType.Name;
                name = name.Substring(0, commandType.Name.Length - "Command".Length);

                string summary = CommandHelpers.GetSummary(commandType);

                Console.WriteLine("   {0} {1}", name.PadRight(10), summary);
            }
        }
Esempio n. 2
0
        public int Run(string[] args)
        {
            if (args.Length == 0)
            {
                Program.ShowHelp();

                return(0);
            }

            string commandName = args[0];

            Type commandType = CommandHelpers.GetCommandType(commandName);

            if (commandType == null)
            {
                Program.ShowHelp();

                return(-1);
            }

            CommandHelpers.WriteHelp(commandType);

            return(0);
        }