<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

using ManyConsole;
using Renderly.Models;
using Renderly.Utils;

namespace RenderlyApp.Options
{
    /// <summary>
    /// This is the ConsoleCommand that handles batch generation of test cases from a file.
    /// The file should be a CSV command with the following column layout:
    /// - test type,
    /// - url/path to retrieve to make your reference image
    /// - release
    /// - description (optional, leave blank if you want)
    /// </summary>
    public class BatchGenTestCaseCommand : ConsoleCommand
    {
        public string InputFile { get; set; }
        public string AppendTestFile { get; set; }
        public string OutputFile { get; set; }
        public bool ModifyInPlace { get; set; }

        public BatchGenTestCaseCommand()
        {
            IsCommand("batchgen");
            HasRequiredOption("f|file=", "CSV file with the test cases to generate.", s => InputFile = s);
            HasRequiredOption("o|out=", "CSV file to output with test cases.", s => OutputFile = s);
            HasOption("a|append=", "Test Cases to append to", s => AppendTestFile = s);
        }


        public override int Run(string[] remainingArguments)
        {
            if (string.IsNullOrWhiteSpace(AppendTestFile))
            {
                Console.WriteLine("Not appending to anything.");
            }
            else
            {
                Console.WriteLine("Appending to {0}", AppendTestFile);
            }

            Console.WriteLine("You are generating tests from {0}", InputFile);
            Console.WriteLine("You are writing out to {0}", OutputFile);

            var model = new CsvModel(OutputFile);
            var shellModel = new ShellTestCsvModel(InputFile);
            model.GenerateTestCases(shellModel.GetTestCases());
            model.Serialize(OutputFile);

            return 0;
        }
    }
}<commit_msg>Whoops, committing to develop branch, but whatever. Add in support for appending to existing test case file.<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

using ManyConsole;
using Renderly.Models;
using Renderly.Utils;

namespace RenderlyApp.Options
{
    /// <summary>
    /// This is the ConsoleCommand that handles batch generation of test cases from a file.
    /// The file should be a CSV command with the following column layout:
    /// - test type,
    /// - url/path to retrieve to make your reference image
    /// - release
    /// - description (optional, leave blank if you want)
    /// </summary>
    public class BatchGenTestCaseCommand : ConsoleCommand
    {
        public string InputFile { get; set; }
        public string AppendTestFile { get; set; }
        public string OutputFile { get; set; }
        public bool ModifyInPlace { get; set; }

        public BatchGenTestCaseCommand()
        {
            IsCommand("batchgen");
            HasRequiredOption("f|file=", "CSV file with the test cases to generate.", s => InputFile = s);
            HasRequiredOption("o|out=", "CSV file to output with test cases.", s => OutputFile = s);
            HasOption("a|append=", "Test Cases to append to", s => AppendTestFile = s);
        }


        public override int Run(string[] remainingArguments)
        {
            var inputCsvFile = OutputFile;
            if (string.IsNullOrWhiteSpace(AppendTestFile))
            {
                Console.WriteLine("Not appending to anything.");
            }
            else
            {
                Console.WriteLine("Appending to {0}", AppendTestFile);
                inputCsvFile = AppendTestFile;
            }

            Console.WriteLine("You are generating tests from {0}", InputFile);
            Console.WriteLine("You are writing out to {0}", OutputFile);

            var model = new CsvModel(inputCsvFile);
            var shellModel = new ShellTestCsvModel(InputFile);
            model.GenerateTestCases(shellModel.GetTestCases());
            model.Serialize(OutputFile);

            return 0;
        }
    }
}
{'fraction_non_alphanumeric': 0.09926731269203498, 'fraction_numerical': 0.0018908059560387616, 'mean_word_length': 2.235474006116208, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2485642', 'n_tokens_mistral': 1088, 'n_tokens_neox': 1083, 'n_words': 355}