aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/DataStore/Tango.DataStore.CLI/Program.cs
blob: e27f76c79863056ee37c76051a5f77dac8c01e0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using CommandLine;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.BL;

namespace Tango.DataStore.CLI
{
    class Program
    {
        static void Main(string[] args)
        {
            var result = Parser.Default.ParseArguments<GetOptions, PutOptions>(args)
            .WithParsed<GetOptions>((options) =>
            {
                Console.WriteLine($"{options.Email}, {options.Password}");
            })
            .WithParsed<PutOptions>((options) => 
            {
                Console.WriteLine($"{options.Email}, {options.Password}");
            })
            .WithNotParsed((errors) => 
            {
                
            });

            Console.ReadLine();
        }

        private static int DisplayHelp<T>(ParserResult<T> result, IEnumerable<Error> errs)
        {
            var helpText = CommandLine.Text.HelpText.AutoBuild(result, h =>
            {
                h.AdditionalNewLineAfterOption = false;
                h.AddNewLineBetweenHelpSections = true;
                h.AddEnumValuesToHelpText = true;
                h.AutoVersion = false;
                h.Heading = CommandLine.Text.HeadingInfo.Empty;
                h.MaximumDisplayWidth = 110;
                //  h.AddVerbs(typeof(SyncOptions), typeof(QueryOptions), typeof(TokenOptions));
                return h;  // only h
            });
            Console.WriteLine(helpText);
            return 1;
        }
    }
}