public void TestMethod_EnvironmentEnvironments()
        {
            OrchestratorConfig.Commands.Add("Environments");
            OrchestratorCommand comand = new OrchestratorCommand();
            var model = comand.CreateCommandModel();

            comand.ExecuteCommand(model);
        }
        public void TestMethod_Release()
        {
            OrchestratorConfig.Commands.Add("Release");
            OrchestratorCommand comand = new OrchestratorCommand();
            var model = comand.CreateCommandModel();

            comand.ExecuteCommand(model);
        }
        public void TestMethod_Settings()
        {
            OrchestratorConfig.Commands.Add("Settings");
            OrchestratorCommand comand = new OrchestratorCommand();
            var model = comand.CreateCommandModel();

            comand.ExecuteCommand(model);
        }
Exemplo n.º 4
0
        private static void ArgsToCommandList(string[] args)
        {
            for (int i = 0; i < args.Length; i++)
            {
                int      next = i + 1;
                ICommand option;
                switch (args[i].Replace("-", "").Substring(0, 1))
                {
                case "v":
                    option = new VersionCommand();
                    if (_options.ContainsKey("v") == false)
                    {
                        _options.Add("v", option);
                    }
                    break;

                case "i":
                    option = new InformationCommand();
                    if (_options.ContainsKey("i") == false)
                    {
                        _options.Add("i", option);
                    }
                    break;

                case "?":
                    option = new InformationCommand();
                    if (_options.ContainsKey("i") == false)
                    {
                        _options.Add("i", option);
                    }
                    break;

                case "h":
                    if (args[i] == "--help")
                    {
                        option = new InformationCommand();
                        if (_options.ContainsKey("i") == false)
                        {
                            _options.Add("i", option);
                        }
                    }
                    else if (args[i] == "-hostname" || args[i].Split('=')[0] == "--host")
                    {
                        OrchestratorConfig.HostName = args[next];
                    }
                    break;

                case "H":
                    OrchestratorConfig.HostName = args[next];
                    break;

                case "f":
                    break;

                case "U":
                    OrchestratorConfig.UserId = args[next];
                    break;

                case "W":
                    OrchestratorConfig.Password = args[next];
                    break;

                case "T":
                    OrchestratorConfig.TenantName = args[next];
                    break;

                case "C":
                    OrchestratorConfig.Commands = args[next].Split(',').ToList <string>();
                    option = new OrchestratorCommand();
                    if (_options.ContainsKey("c") == false)
                    {
                        _options.Add("c", option);
                    }
                    break;

                default:
                    break;
                }
            }

            if (CommandManager._options.Count == 0 ||
                CommandManager._options.ContainsKey("i"))
            {
                CommandManager._options = new Dictionary <string, ICommand>()
                {
                    { "i", new InformationCommand() }
                }
            }
            ;

            else if (CommandManager._options.ContainsKey("v"))
            {
                CommandManager._options = new Dictionary <string, ICommand>()
                {
                    { "v", new VersionCommand() }
                }
            }
            ;
        }

        #endregion
    }