Example #1
0
        private static bool ConfirmFileWrite(string outputFile)
        {
            if (ButlerReaderService.Exists(outputFile))
            {
                Console.WriteLine($"\nFile already exists at {outputFile}. Overwriting.");
                return(true);
            }

            Console.WriteLine($"\nFile at path {outputFile} does not exist.\nDo you want to create a new file (y/n)?");
            ConsoleKeyInfo input = Console.ReadKey();

            switch (input.Key)
            {
            case ConsoleKey.Y:
                Console.WriteLine($"\nCreating new file at {outputFile}.");
                return(true);

            case ConsoleKey.N:
                Console.WriteLine("\nCode generation aborted.");
                return(false);

            default:
                Console.WriteLine("\nERROR: Invalid option. Generation aborted.");
                return(false);
            }
        }
Example #2
0
        private static void HandleFromFile(string inputFile, string outputFile)
        {
            string fileContents = ButlerReaderService.ReadAllText(inputFile);

            HandleFromJson(fileContents, outputFile);
        }