Exemplo n.º 1
0
        public new void Execute(FigaroContext context, string args)
        {
            try
            {
                if (string.IsNullOrEmpty(args))
                {
                    context.CreateContainer(string.Empty, "in", false);
                    return;
                }
                base.Execute(context, args);
                ValidateArgCount(1, 3);
                //ValidatePath(argv[0]);
                bool   validate = false;
                string ctyp     = string.Empty;
                string w        = string.Empty;
                if (argv.Length > 1)
                {
                    ValidateLiteral(argv[1].ToLower(), new[] { "n", "in", "d", "id" });
                    ctyp = argv[1].ToLower();
                    switch (ctyp)
                    {
                    case "n":
                        w = "with node storage enabled.";
                        break;

                    case "in":
                        w = "with indexed node storage enabled.";
                        break;

                    case "d":
                        w = "with Wholedoc storage enabled.";
                        break;

                    case "id":
                        w = "with indexed Wholedoc storage enabled.";
                        break;
                    }
                }
                else
                {
                    w = "with default container settings enabled.";
                }

                if (argv.Length > 2)
                {
                    ValidateLiteral(argv[2], new[] { "validate", "novalidate" });
                    validate = argv[2].Equals("validate");
                }

                context.CreateContainer(argv[0], ctyp, validate);
                Msg("created container {0} {1}", argv[0], w);
            }
            catch (ValidationException)
            {
                return;
            }
        }