Esempio n. 1
0
        public void Eval(params string[] input)
        {
            if (input.IsNullOrEmpty())
            {
                return;
            }

            string     commandName = input.First();
            CommandDef cmd         = this[commandName];

            if (cmd == null)
            {
                this.ShowUsageCommandNotFound(commandName);
                return;
            }

            try
            {
                cmd.Eval((input.Select(arg => arg)).Skip(1).ToArray());
            }
            catch (Exception ex)
            {
                this.HandleError(ex);
                CommandUI.PrintSectionBreak();
                cmd.ShowUsage();
            }
        }
Esempio n. 2
0
 void ShowUsageCommandNotFound(string commandName)
 {
     Console.WriteLine();
     CommandUI.PrintUpperCase("{0}:  No such command.", commandName);
     CommandUI.PrintSectionBreak();
     //
     // Speculatively print out names of commands with this prefix..
     //
     if (this.PrefixMatchCommandNames(commandName).FirstOrDefault() != null)
     {
         //
         // Speculatively print out names of commands with this prefix..
         //
         CommandUI.PrintHeading("Did you mean?");
         this.ListCommands(new string[] { commandName });
     }
     else
     {
         Console.WriteLine(HelpUsage);
     }
 }