private static bool CreateCommand(out Command command,string name, string[] args) { command = null; if (name == "i") { if (args.Length == 1) { command = new InstallOnSiteCommand(args[0], _profileeManager); } } else if (name == "u") { if (args.Length == 1) { command = new UninstallOnSiteCommand(args[0], _profileeManager); } } else if (name == "s") { command = new ShowConfigurationCommand(_profileeManager,new ClrConfigurator(System.Console.WriteLine)); } else if (name == "asm") { if (args.Length == 1) { command = new ConfigureAssemblyCommand(args[0],new ClrConfigurator(System.Console.WriteLine)); } } else if (name == "?") { if (args.Length == 0) { command = new HelpCommand(); } } return command != null; }
private static bool ParseArguments(string[] args, out Command command) { command = null; if(args.Length ==0) { return false; } if (!args[0].StartsWith("-")) { return false; } return CreateCommand(out command, args[0].Substring(1), args.Skip(1).ToArray()); }