示例#1
0
        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);
        }
示例#2
0
        /// <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);
        }
示例#3
0
 public static Verbosity ParseVerbosity(System.CommandLine.Parsing.ArgumentResult result)
 {
     if (result.Tokens.Count == 0)
     {
         return(default);
示例#4
0
 internal static Show ParseShow(System.CommandLine.Parsing.ArgumentResult result)
 {
     if (result.Tokens.Count == 0)
     {
         return(default);