private void CheckForOptionErrors()
        {
            foreach (var option in AppliedOptions.FlattenBreadthFirst())
            {
                var error = option.Validate();

                if (error != null)
                {
                    errors.Add(error);
                }
            }
        }
Ejemplo n.º 2
0
        private void CheckForErrors()
        {
            foreach (var option in AppliedOptions.FlattenBreadthFirst())
            {
                var error = option.Validate();

                if (error != null)
                {
                    errors.Add(error);
                }
            }

            var command = Command();

            if (command != null &&
                command.DefinedOptions.Any(o => o.IsCommand))
            {
                errors.Insert(0, new OptionError(
                                  RequiredCommandWasNotProvided(),
                                  command.Name,
                                  this.AppliedCommand()));
            }
        }
Ejemplo n.º 3
0
 public Command Command() =>
 command ??
 (command = configuration.RootCommandIsImplicit
                    ? configuration.DefinedOptions.OfType <Command>().Single()
                    : AppliedOptions.Command());
 public bool HasOption(string alias) => AppliedOptions.Contains(alias);