public void Run(string[] args) { var lowerCasedArgs = args.Select(arg => arg.ToLower()).ToList(); string destinationPath = ""; if (lowerCasedArgs.Contains(DestinationArgCommandDeclaration.ToLower())) { var destinationArgCommandDeclarationIndex = lowerCasedArgs.IndexOf(DestinationArgCommandDeclaration.ToLower()); var destinationArgIndex = destinationArgCommandDeclarationIndex + 1; if (!(args.Length <= destinationArgIndex || ForceArgCommandDeclaration == args[destinationArgIndex])) { destinationPath = args[destinationArgIndex]; } } bool force = args.Contains(ForceArgCommandDeclaration); var fileModel = _highLightRulesGenerator.GetDbTemplateAceMode(); string destinationFileFullName; if (String.IsNullOrWhiteSpace(destinationPath)) { destinationFileFullName = Path.Combine(Directory.GetCurrentDirectory(), fileModel.FileName); } else { destinationFileFullName = Path.Combine(Directory.GetCurrentDirectory(), destinationPath, fileModel.FileName); } if (File.Exists(destinationFileFullName) && force) { File.Delete(destinationFileFullName); } else if (!force) { System.Console.Error.WriteLine($"{destinationFileFullName} already exists, nothing has been done. You can use '-Force' arg in order to overwrite the existing file"); return; } var directoryRoot = Path.GetDirectoryName(destinationFileFullName); if (!Directory.Exists(directoryRoot)) { Directory.CreateDirectory(directoryRoot); } File.WriteAllText(destinationFileFullName, fileModel.Content); System.Console.WriteLine($"{destinationFileFullName} successfully created"); }
public void GetDbTemplateAceMode() { var result = _tested.GetDbTemplateAceMode(); WriteInTestContext(result); }