Пример #1
0
        static int Main(string[] args)
        {
            ConfigOptions options = GetOptions(args);

            Console.WriteLine(options.ToString());

            var workdir = options.WorkDir;
            var csvPath = options.Output;

            Console.WriteLine(workdir);
            Console.WriteLine(csvPath);

            var list = GetCommitLogs(workdir);

            switch (Path.GetExtension(options.Output)?.TrimStart('.') ?? "csv")
            {
            case "json":
            {
                GenerateJson(csvPath, list);
                break;
            }

            case "csv":
            {
                GenerateCsv(csvPath, list);
                break;
            }
            }
            Console.WriteLine("done");
            return(0);
        }
Пример #2
0
        private static ConfigOptions GetOptions(string[] args)
        {
            var switchMappings = new Dictionary <string, string> {
                { "-d", "workdir" },
                { "-o", "output" },
            };
            var configRoot = new ConfigurationBuilder()
                             .AddCommandLine(args, switchMappings)
                             .Build();

            var options = new ConfigOptions();

            configRoot.Bind(options);
            return(options);
        }