public static bool InitAndSetup(string[] args) { SetToDefaults(); if (OptionsParser.HelpRequested(args)) { OptionsParser.DisplayHelp(typeof(Program).Assembly, false); return(false); } var unknownArgs = OptionsParser.Prepare(args, typeof(Program).Assembly, false).ToList(); if (unknownArgs.Count > 0) { Console.WriteLine("Unknown arguments : "); foreach (var remain in unknownArgs) { Console.WriteLine("\t {0}", remain); } return(false); } if (!ValidateArguments()) { return(false); } return(true); }
public void TestHelpRequested_WhenNotRequested() { Assert.IsFalse(OptionsParser.HelpRequested(new[] { "--other", "--other2" })); }
public void TestHelpRequested_WhenRequested() { Assert.IsTrue(OptionsParser.HelpRequested(new[] { "--help" })); Assert.IsTrue(OptionsParser.HelpRequested(new[] { "--h" })); Assert.IsTrue(OptionsParser.HelpRequested(new[] { "--other", "--help" })); }