public static ShowCliHelp ( OptionSet options, |
||
options | OptionSet | |
thisAssembly | ||
return | void |
/// <summary> /// Handle command line args /// </summary> /// <param name="args"></param> public static void Main(string[] args) { OptionSet options = new OptionSet(); String configDir = ClientServerConnection.DefaultConfigDir; options.Add("c|configdir=", "configuration directory (default=" + configDir + ")", delegate(string v) { configDir = Common.EndDirWithSlash(v); }); options.Add("h|help", "show help screen", delegate(string v) { Common.ShowCliHelp(options, System.Reflection.Assembly.GetExecutingAssembly()); }); options.Add("v|version", "print the Mybox version", delegate(string v) { Console.WriteLine(Common.AppVersion); System.Diagnostics.Process.GetCurrentProcess().Kill(); }); // Note: all additional arguments are invalid since it does not take non-options List <string> extra = new List <string>(); try { extra = options.Parse(args); } catch (OptionException) { Console.WriteLine("Invalid argument entered"); // print the help screen Common.ShowCliHelp(options, System.Reflection.Assembly.GetExecutingAssembly()); } if (extra.Count > 0) { Console.WriteLine("Invalid argument entered"); // print the help screen Common.ShowCliHelp(options, System.Reflection.Assembly.GetExecutingAssembly()); } new Client(configDir); }