Run() public static method

public static Run ( ListOptions options, Client client ) : int
options ListOptions
client Client
return int
Beispiel #1
0
        public async Task Main(string[] args)
        {
            client = await new AuthManager(args).Connect();

            var command = Console.ReadLine();

            while (command != "exit")
            {
                try
                {
                    var exitCode = CommandLine.Parser.Default.ParseArguments <
                        StatsOptions,
                        PutOptions,
                        GetOptions,
                        ListOptions,
                        DeleteOptions>(command.ParseArguments()).MapResult(
                        (StatsOptions opts) => StatsCommand.Run(opts, client),
                        (PutOptions opts) => PutCommand.Run(opts, client),
                        (GetOptions opts) => GetCommand.Run(opts, client),
                        (ListOptions opts) => ListCommand.Run(opts, client),
                        (DeleteOptions opts) => DeleteCommand.Run(opts, client),
                        errs => 1);
                }
                catch (Exception ex)
                {
                    Logger.LogError(ex.InnerException != null ? ex.InnerException.Message : ex.Message);
                }

                command = Console.ReadLine();
            }
        }
Beispiel #2
0
        public static void Main(string[] args)
        {
            var authManager = new AuthManager(args);

            client = authManager.Connect().Result;

            var command = Console.ReadLine();

            while (command != "exit")
            {
                try
                {
                    var exitCode = Parser.Default.ParseArguments <
                        StatsOptions,
                        PutOptions,
                        GetOptions,
                        ListOptions,
                        ExportOptions,
                        ImportOptions,
                        DeleteOptions>(command.ParseArguments()).MapResult(
                        (StatsOptions opts) => StatsCommand.Run(opts, client),
                        (PutOptions opts) => PutCommand.Run(opts, client),
                        (GetOptions opts) => GetCommand.Run(opts, client),
                        (ListOptions opts) => ListCommand.Run(opts, client),
                        (ExportOptions opts) => ExportCommand.Run(opts, client, authManager),
                        (ImportOptions opts) => ImportCommand.Run(opts, client, authManager),
                        (DeleteOptions opts) => DeleteCommand.Run(opts, client),
                        errs => 1);
                }
                catch (Exception ex)
                {
                    Logger.LogError(ex.InnerException != null ? ex.InnerException.Message : ex.Message);
                }

                command = Console.ReadLine();
            }
        }