public static SemVer ParseMinSemVer(System.CommandLine.Parsing.ArgumentResult result) { if (result.Tokens.Count == 0) { return(Program.DefaultOptions.MinimumVersion); } var tokenValue = result.Tokens.Single().Value; if (!SemVer.TryParse(tokenValue, out var version)) { result.ErrorMessage = $"Failed to parse version {tokenValue} for option {result.Argument.Name}"; return(Program.DefaultOptions.MinimumVersion); } return(version.Value); }
/// <summary> /// Parse out the scope strings into PAT enumeration values /// </summary> /// <param name="argumentResult"></param> /// <returns></returns> private static List <AzureDevOpsPATScopes> ParsePATScopes(System.CommandLine.Parsing.ArgumentResult argumentResult) { List <AzureDevOpsPATScopes> scopes = new List <AzureDevOpsPATScopes>(); foreach (var token in argumentResult.Tokens) { if (Enum.TryParse(token.Value, ignoreCase: true, out AzureDevOpsPATScopes patScope)) { scopes.Add(patScope); } else { argumentResult.ErrorMessage = $"'{token.Value}' is not a valid scope"; } } return(scopes); }
public static Verbosity ParseVerbosity(System.CommandLine.Parsing.ArgumentResult result) { if (result.Tokens.Count == 0) { return(default);
internal static Show ParseShow(System.CommandLine.Parsing.ArgumentResult result) { if (result.Tokens.Count == 0) { return(default);