<commit_before>﻿using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using DocoptNet;

namespace BaconTime.Terminal
{
    public class MainArgs
    {
        public const string Usage = @"Magic Times

    Usage:
      magictimes log <time> <ticket> [--when=<date>] [--log-type=<type>] <message>... 
      magictimes show logged hours <user> [--from=<date>]  [--to=<date>]  [--working-hours=<hours>]  

    Options:
      -h --help                 Show this screen.
      --when=<date>             The date for wen time log entry YYYY-MM-DD [default:now]
      --log-type=<type>         Type of timelogging billable [default:30]
      --from=<date>             The first inclussive date of the time period [default:today-30days]
      --working-hours=<hours>   The number of working hours in a working day [default:8]
    ";
        private readonly IDictionary<string, ValueObject> args;
        public MainArgs(ICollection<string> argv, bool help = true, object version = null, bool optionsFirst = false, bool exit = false)
        {
            args = new Docopt().Apply(Usage, argv, help, version, optionsFirst, exit);
        }

        public IDictionary<string, ValueObject> Args => args;

        public bool CmdLog => args["log"].IsTrue;
        public bool CmdShowLoggedHours => args["show"].IsTrue && args["logged"].IsTrue && args["hours"].IsTrue;

        public int OptTicket => Convert.ToInt32(args["<ticket>"].ToString());
        public int OptTimeType => Extract("log-type", 30);
        public DateTime OptWhen => Extract("When", DateTime.Now);
        public int OptWorkingHOurs => Extract("working-hours", 8);

        private T Extract<T>(string key, T defaultValue) => args.ContainsKey(key) ? (T)Convert.ChangeType(args[key].Value, typeof(T)) : defaultValue;

        public int OptHours => ConvertTo(args["<time>"].ToString(), "h");
        public int OptMinutes => ConvertTo(args["<time>"].ToString(), "h");

        public DateTime OptFrom => DateTime.Today.AddDays(-30);
        public DateTime OptTo => DateTime.Today;
<commit_msg>fixed the options for docopt<commit_after>﻿using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using DocoptNet;

namespace BaconTime.Terminal
{
    public class MainArgs
    {
        public const string Usage = @"Magic Times

    Usage:
      magictimes log <time> <ticket> [--when=<date>] [--log-type=<type>] <message>... 
      magictimes show logged hours <user> [--from=<date>]  [--to=<date>]  [--working-hours=<hours>]  

    Options:
      -h --help                 Show this screen.
      --when=<date>             The date for wen time log entry YYYY-MM-DD [default:now]
      --log-type=<type>         Type of timelogging billable [default:30]
      --from=<date>             The first inclussive date of the time period [default:today-30days]
      --to=<date>           The last inclussive date of the time period [default:today]
      --working-hours=<hours>   The number of working hours in a working day [default:8]
    ";
        private readonly IDictionary<string, ValueObject> args;
        public MainArgs(ICollection<string> argv, bool help = true, object version = null, bool optionsFirst = false, bool exit = false)
        {
            args = new Docopt().Apply(Usage, argv, help, version, optionsFirst, exit);
        }

        public IDictionary<string, ValueObject> Args => args;

        public bool CmdLog => args["log"].IsTrue;
        public bool CmdShowLoggedHours => args["show"].IsTrue && args["logged"].IsTrue && args["hours"].IsTrue;

        public int OptTicket => Convert.ToInt32(args["<ticket>"].ToString());
        public int OptTimeType => Extract("--log-type", 30);
        public DateTime OptWhen => Extract("--when", DateTime.Now);
        public int OptWorkingHOurs => Extract("--working-hours", 8);

        private T Extract<T>(string key, T defaultValue) => args.ContainsKey(key) ? (T)Convert.ChangeType(args[key].Value, typeof(T)) : defaultValue;

        public int OptHours => ConvertTo(args["<time>"].ToString(), "h");
        public int OptMinutes => ConvertTo(args["<time>"].ToString(), "h");

        public DateTime OptFrom => DateTime.Today.AddDays(-30);
        public DateTime OptTo => DateTime.Today;

{'fraction_non_alphanumeric': 0.13802751224061552, 'fraction_numerical': 0.00559570995570063, 'mean_word_length': 2.9393939393939394, 'pattern_counts': {'":': 0, '<': 44, '<?xml version=': 0, '>': 68, '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': '5544943', 'n_tokens_mistral': 1300, 'n_tokens_neox': 1216, 'n_words': 350}