<commit_before>﻿using System;
using System.IO;
using System.Linq;
using System.Text;
using Loader.Loader;
using Loader.Validator;
using ManyConsole;

namespace Loader {
    public class ValidateCommand : ConsoleCommand {
        private const ConsoleColor Success = ConsoleColor.DarkGreen;
        private const ConsoleColor Failure = ConsoleColor.DarkRed;
        private const ConsoleColor Normal = ConsoleColor.Gray;
        private const ConsoleColor Notice = ConsoleColor.Yellow;
        public string ConfigPath;

        public ValidateCommand() {
            IsCommand("validate", "Validate configuration.");
            HasOption("p|path:", "Configuration Path", p => ConfigPath = Path.GetFullPath(p));
        }

        private void WriteInternal(Action<string> writer, string line, ConsoleColor color) {
            var previousColor = Console.ForegroundColor;
            Console.ForegroundColor = color;
            writer(line);
            Console.ForegroundColor = previousColor;
        }

        private void Write(string line, ConsoleColor color) {
            WriteInternal(Console.Write, line, color);
        }

        private void WriteLine(string line, ConsoleColor color) {
            WriteInternal(Console.WriteLine, line, color);
        }

        private void WriteAscii(string line, ConsoleColor color) {
            WriteInternal(Colorful.Console.WriteAscii, line, color);
        }

        private void WriteResult(string item, ErrorModel model) {
            Write($"{item} ", Normal);
            if (model.IsValid) {
                WriteLine("✔", Success);
            } else {
                WriteLine("✘", Failure);
            }
        }

        public override int Run(string[] remainingArguments) {
            Console.OutputEncoding = Encoding.UTF8;

            WriteAscii("VALIDATE", Notice);

            var loader = new ConfigurationLoader();
            var configuration = loader.Load(ConfigPath);
            var result = configuration.Validate();

            WriteResult($"{configuration.Directory.FullName}", result);
<commit_msg>Added pointless extra text for fun.<commit_after>﻿using System;
using System.IO;
using System.Linq;
using System.Text;
using Loader.Loader;
using Loader.Validator;
using ManyConsole;

namespace Loader {
    public class ValidateCommand : ConsoleCommand {
        private const ConsoleColor Success = ConsoleColor.DarkGreen;
        private const ConsoleColor Failure = ConsoleColor.DarkRed;
        private const ConsoleColor Normal = ConsoleColor.Gray;
        private const ConsoleColor Notice = ConsoleColor.Yellow;
        public string ConfigPath;

        public ValidateCommand() {
            IsCommand("validate", "Validate configuration.");
            HasOption("p|path:", "Configuration Path", p => ConfigPath = Path.GetFullPath(p));
        }

        private void WriteInternal(Action<string> writer, string line, ConsoleColor color) {
            var previousColor = Console.ForegroundColor;
            Console.ForegroundColor = color;
            writer(line);
            Console.ForegroundColor = previousColor;
        }

        private void Write(string line, ConsoleColor color) {
            WriteInternal(Console.Write, line, color);
        }

        private void WriteLine(string line, ConsoleColor color) {
            WriteInternal(Console.WriteLine, line, color);
        }

        private void WriteAscii(string line, ConsoleColor color) {
            WriteInternal(Colorful.Console.WriteAscii, line, color);
        }

        private void WriteResult(string item, ErrorModel model) {
            Write($"{item} ", Normal);
            if (model.IsValid) {
                WriteLine("✔", Success);
            } else {
                WriteLine("✘", Failure);
            }
        }

        public override int Run(string[] remainingArguments) {
            Console.OutputEncoding = Encoding.UTF8;

            WriteAscii("@CHECKY", ConsoleColor.DarkBlue);
            WriteAscii("VALIDATE", Notice);

            var loader = new ConfigurationLoader();
            var configuration = loader.Load(ConfigPath);
            var result = configuration.Validate();

            WriteResult($"{configuration.Directory.FullName}", result);

{'fraction_non_alphanumeric': 0.09174096668230877, 'fraction_numerical': 0.0004692632566870014, 'mean_word_length': 2.4268488745980705, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '654275', 'n_tokens_mistral': 1032, 'n_tokens_neox': 1003, 'n_words': 273}