示例#1
0
        /// <summary>
        /// Validates that the specified exclusive option is available.
        /// </summary>
        private static void ValidateExclusiveOptionValueIsAvailable(OptionResult result, Option exclusive)
        {
            OptionResult exclusiveResult = result.FindResultFor(exclusive);

            if (!result.IsImplicit && exclusiveResult != null && !exclusiveResult.IsImplicit)
            {
                result.ErrorMessage = $"Setting options '{result.Option.Name}' and '{exclusive.Name}' at the same time is not allowed.";
            }
        }
示例#2
0
        /// <summary>
        /// Validates that the specified prerequisite option is available.
        /// </summary>
        private static void ValidatePrerequisiteOptionValueIsAvailable(OptionResult result, Option prerequisite)
        {
            OptionResult prerequisiteResult = result.FindResultFor(prerequisite);

            if (!result.IsImplicit && (prerequisiteResult is null || prerequisiteResult.IsImplicit))
            {
                result.ErrorMessage = $"Setting option '{result.Option.Name}' requires option '{prerequisite.Name}'.";
            }
        }