public static bool TryParse(IList <string> args, out Parameters parameters) { parameters = null; var p = new Parameters { Message = "Committed by SvnClient", }; var optionSet = new OptionSet { { "username="******"SVN username", v => p.Username = v }, { "password="******"SVN password", v => p.Password = v }, { "k|trust-server-cert", "Trust unsigned/expired server certificates", v => p.TrustServerCert = (v != null) }, { "m|message=", "Commit message for CompleteSync commit or CheckoutUpdate remote directory add", v => p.Message = v }, { "u|updatebeforesync", "SVN update first (CompleteSync only)", v => p.UpdateBeforeCompleteSync = (v != null) }, { "revert", "Revert changes first (CheckoutUpdate only)", v => p.Revert = (v != null) }, { "cleanup", "CleanUp working copy first (CheckoutUpdate only)", v => p.Cleanup = (v != null) }, { "deleteunversioned", "Delete unversioned files from working copy first (CheckoutUpdate only)", v => p.DeleteUnversioned = (v != null) }, { "cleanworkingcopy", "Same as --revert --cleanup --deleteunversioned (CheckoutUpdate only)", v => p.Revert = p.Cleanup = p.DeleteUnversioned = (v != null) }, { "mkdir", "Create the URL if it doesn't exist (CheckoutUpdate only)", v => p.Mkdir = (v != null) }, { "v|verbose", "Print extra messages", v => p.Verbose = (v != null) }, }; var extraArgs = optionSet.Parse(args); if (extraArgs.Count == 0) { Console.Error.WriteLine("No command specified."); ShowUsage(optionSet); return(false); } Command command; if (EnumTryParse(extraArgs[0], true, out command)) { p.Command = command; } else { Console.Error.WriteLine("Unknown command: " + extraArgs[0]); ShowUsage(optionSet); return(false); } switch (p.Command) { case Command.CompleteSync: if (extraArgs.Count < 2) { Console.Error.WriteLine("path is required"); ShowUsage(optionSet); return(false); } p.Path = extraArgs[1]; //костыль if (p.Path.IndexOf("--message=") == 0) { p.Path = extraArgs[2]; p.Message = extraArgs[1]; } break; case Command.CheckoutUpdate: if (extraArgs.Count < 3) { Console.Error.WriteLine("URL and path are required"); ShowUsage(optionSet); return(false); } p.Url = extraArgs[1]; p.Path = extraArgs[2]; break; } parameters = p; return(true); }