示例#1
0
        public static void Validate(CommandModel model, ConfigurationSettings settings)
        {
            if (model.Commands.Count == 0 && model.DefaultCommand == null)
            {
                throw ConfigurationException.NoCommandConfigured();
            }

            foreach (var command in model.Commands)
            {
                // Alias collision?
                foreach (var alias in command.Aliases)
                {
                    if (model.Commands.Any(x => x.Name.Equals(alias, StringComparison.OrdinalIgnoreCase)))
                    {
                        throw ConfigurationException.CommandNameConflict(command, alias);
                    }
                }
            }

            foreach (var command in model.Commands)
            {
                Validate(command);
            }

            if (settings.ValidateExamples)
            {
                ValidateExamples(model);
            }
        }
        public static void Validate(CommandModel model)
        {
            if (model.Commands.Count == 0 && model.DefaultCommand == null)
            {
                throw ConfigurationException.NoCommandConfigured();
            }

            foreach (var command in model.Commands)
            {
                Validate(command);
            }
        }