<commit_before>﻿using System.Collections.Generic;
using FlubuCore.Context;

namespace FlubuCore.Tasks.Process
{
    public abstract class ExternalProcessTaskBase<TTask> : TaskBase<int, TTask>, IExternalProcess<TTask>
        where TTask : class, ITask
    {
        /// <summary>
        /// Gets or sets working folder.
        /// </summary>
        /// <value>
        /// Working folder.
        /// </value>
        protected string ExecuteWorkingFolder { get; set; }

        /// <summary>
        /// Executable path.
        /// </summary>
        protected string ExecutablePath { get; set; }

        /// <summary>
        /// Do not log to console if possible.
        /// </summary>
        protected bool NoOutputLog { get; set; }

        internal List<string> Arguments { get; } = new List<string>();

        protected TTask InsertArgument(int index, string arg)
        {
            if (!string.IsNullOrEmpty(arg))
            {
                 Arguments.Insert(index, arg);
            }

            return this as TTask;
        }

        /// <inheritdoc />
        public TTask WithArguments(string arg)
        {
            if (!string.IsNullOrEmpty(arg))
            {
                Arguments.Add(arg);
            }

            return this as TTask;
        }

        /// <inheritdoc />
        public TTask WithArguments(params string[] args)
        {
            Arguments.AddRange(args);
            return this as TTask;
        }

        /// <inheritdoc />
        public TTask WorkingFolder(string folder)
        {
            ExecuteWorkingFolder = folder;
            return this as TTask;
        }

        /// <inheritdoc />
        public TTask DoNotLogOutput()
        {
            NoOutputLog = true;
            return this as TTask;
        }
<commit_msg>Adds infrastructure for validating required key/value arguments.<commit_after>﻿using System.Collections.Generic;
using FlubuCore.Context;

namespace FlubuCore.Tasks.Process
{
    public abstract class ExternalProcessTaskBase<TTask> : TaskBase<int, TTask>, IExternalProcess<TTask>
        where TTask : class, ITask
    {
        /// <summary>
        /// Gets or sets working folder.
        /// </summary>
        /// <value>
        /// Working folder.
        /// </value>
        protected string ExecuteWorkingFolder { get; set; }

        /// <summary>
        /// Executable path.
        /// </summary>
        protected string ExecutablePath { get; set; }

        /// <summary>
        /// Do not log to console if possible.
        /// </summary>
        protected bool NoOutputLog { get; set; }

        internal List<string> Arguments { get; } = new List<string>();

        protected TTask InsertArgument(int index, string arg)
        {
            if (!string.IsNullOrEmpty(arg))
            {
                 Arguments.Insert(index, arg);
            }

            return this as TTask;
        }

        /// <inheritdoc />
        public TTask WithArguments(string arg)
        {
            if (!string.IsNullOrEmpty(arg))
            {
                Arguments.Add((arg, null, false));
            }

            return this as TTask;
        }

        /// <inheritdoc />
        public TTask WithArguments(params string[] args)
        {
            Arguments.AddRange(args);
            return this as TTask;
        }

        /// <inheritdoc />
        public TTask WorkingFolder(string folder)
        {
            ExecuteWorkingFolder = folder;
            return this as TTask;
        }

        /// <inheritdoc />
        public TTask DoNotLogOutput()
        {
            NoOutputLog = true;
            return this as TTask;
        }

{'fraction_non_alphanumeric': 0.10597826086956522, 'fraction_numerical': 0.0, 'mean_word_length': 1.4458471760797342, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 37, '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': '3132299', 'n_tokens_mistral': 965, 'n_tokens_neox': 932, 'n_words': 248}