/// <summary> /// Initialize command line args parser /// </summary> /// <param name="args"></param> private static bool SetupCLI(string[] args) { ICommandParser cli = null; try { cli = CLI.Parser().Title("xsltator").Version("1.0.0").HelpText("Utility for applying an xslt to an xml"); var xslt = cli.Parameter <string>("xslt").Required(true).HelpText("Xslt file path"); var xml = cli.Parameter <string>("xml").Required(true).HelpText("Xml file path"); var html = cli.Parameter <string>("html").Required(false).HelpText("Optional output html file path"); cli.Parse(args); xsltPath = xslt.Value; xmlPath = xml.Value; htmlPath = html.IsSet ? html.Value : Path.ChangeExtension(xmlPath, "html"); } catch (Exception exception) { using (CLI.WithColors(ConsoleColor.White, ConsoleColor.Red)) { Console.WriteLine($"\nError while reading command line:\t{exception.Message}\n"); using (CLI.WithForeground(ConsoleColor.Black)) { Console.WriteLine("Press any..."); Console.ReadKey(); return(false); } } } return(true); }