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

namespace DMT.Partition.Module.CLI
{
    class CommandLineArgs
    {
        private string[] args;
        private bool showHelp = false;

        public string ModelFilePath { get; private set; }
        public string JobBinaryPath { get; private set; }

        public CommandLineArgs(string[] args)
        {
            this.args = args;
        }

        public void Parse()
        {
            var p = new OptionSet()
            {
                { "m|model=", "Path of the model file.", v => this.ModelFilePath = v },
                { "j|job=", "Path of the first job's binary.", v => this.JobBinaryPath = v },
                { "h|?|help", "Show this message.", v => this.showHelp = v != null },
            };

            p.Parse(this.args);

            if (this.showHelp)
            {
                Console.WriteLine("Usage: {0} [OPTIONS]", AppDomain.CurrentDomain.FriendlyName);
                p.WriteOptionDescriptions(Console.Out);
                Environment.Exit(0);
            }

            if (string.IsNullOrEmpty(this.ModelFilePath))
            {
                AskForModelPath();
            }
            if (string.IsNullOrEmpty(this.JobBinaryPath))
            {
                AskForJobBinaryPath();
            }
        }

        private void AskForModelPath()
        {<commit_msg>added matchmode command line option<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DMT.Matcher.Interfaces;
using NDesk.Options;

namespace DMT.Partition.Module.CLI
{
    class CommandLineArgs
    {
        private string[] args;
        private bool showHelp = false;

        public string ModelFilePath { get; private set; }
        public string JobBinaryPath { get; private set; }
        public MatchMode? MatchMode { get; private set; }

        public CommandLineArgs(string[] args)
        {
            this.args = args;
        }

        public void Parse()
        {
            var p = new OptionSet()
            {
                { "m|model=", "Path of the model file.", v => this.ModelFilePath = v },
                { "j|job=", "Path of the first job's binary.", v => this.JobBinaryPath = v },
                { "h|?|help", "Show this message.", v => this.showHelp = v != null },
                { "mode=", "Mode of the matcher jobs. (either all or firstonly)", var => this.MatchMode = (MatchMode)Enum.Parse(typeof(MatchMode), var, true) },
            };

            p.Parse(this.args);

            if (this.showHelp)
            {
                Console.WriteLine("Usage: {0} [OPTIONS]", AppDomain.CurrentDomain.FriendlyName);
                p.WriteOptionDescriptions(Console.Out);
                Environment.Exit(0);
            }

            if (string.IsNullOrEmpty(this.ModelFilePath))
            {
                AskForModelPath();
            }
            if (string.IsNullOrEmpty(this.JobBinaryPath))
            {
                AskForJobBinaryPath();
            }
        }

        private void AskForModelPath()
        {
{'fraction_non_alphanumeric': 0.1120396162178892, 'fraction_numerical': 0.0012380068090374497, 'mean_word_length': 1.7136859781696054, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, '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': '7656575', 'n_tokens_mistral': 884, 'n_tokens_neox': 857, 'n_words': 211}