private void Execute(CliCommand cliCommand, Cmd cmd) { try { cliCommand.Execute(cmd); } catch (ArgumentError e) { clti.WriteError(e.Message); clti.WriteError(cliCommand.Help); } }
static void Main(string[] args) { if (args == null || args.Length == 0) { return; } string typeName = string.Format("ConcurrentProgramming.CLI.{0}CliCommand", args[0]); CliCommand cliCommand = (CliCommand)Activator.CreateInstance(Type.GetType(typeName)); cliCommand.Execute(args); Console.Read(); }