static Infrastructure.Enumerations.PathingMode GetPathing(string paramValue) { // Default to relative Infrastructure.Enumerations.PathingMode mode = Infrastructure.Enumerations.PathingMode.Relative; switch (paramValue) { case "rel": mode = Infrastructure.Enumerations.PathingMode.Relative; break; case "abs": mode = Infrastructure.Enumerations.PathingMode.Absolute; break; default: break; } return(mode); }
static void Main(string[] args) { string AppVersion = "1.00"; string appPath = Infrastructure.Helpers.FileHelper.GetCurrentApplicationDirectory(); Console.WriteLine("NITCH (.NET Integrated Template Compiler for HTML)"); Console.WriteLine($"Version: {AppVersion}"); Console.Write("\n"); // // PROGRAM ARGUMENTS // Parser parser = new Parser(args); if (parser.Parameters.Count == 0) { Console.Write(GetHelpText()); Console.Write("\n"); } else { Infrastructure.Enumerations.PathingMode pathingMode = Infrastructure.Enumerations.PathingMode.Relative; // Determine file pathinig mode if (parser.HasParam("pathing")) { pathingMode = GetPathing(parser.GetParam("pathing")); } // Attempt to run program if (parser.HasParam("create")) { if (String.IsNullOrEmpty(parser.GetParam("create"))) { // Run default project file/folder creation Nitchify builder = new Nitchify(appPath); builder.Create(); } else { // Run project file/folder creation at the given path Nitchify builder = new Nitchify(parser.GetParam("create")); builder.Create(); } } if (parser.HasParam("build")) { if (String.IsNullOrEmpty(parser.GetParam("build"))) { // Run default build in the current folder Nitchify builder = new Nitchify(appPath, pathingMode); builder.Build(); } else { // Run build in specified folder string startPath = parser.GetParam("build"); if (System.IO.Directory.Exists(startPath)) { Nitchify builder = new Nitchify(startPath, pathingMode); builder.Build(); } else { Console.WriteLine($"ERROR: Path not found: {startPath}"); return; } } } } }