2 writes to Value
System.CommandLine (2)
Parsing\Token.cs (2)
18Value = value ?? ""; 26Value = value ?? "";
156 references to Value
aspire (1)
Templating\CliTemplateFactory.EmptyTemplate.cs (1)
112string.Equals(token.Value, "--localhost-tld", StringComparisons.CliInputOrOutput));
Aspire.RuntimeIdentifier.Tool (1)
Program.cs (1)
81args.AddRange(token.Value.Split(','));
crossgen2 (9)
Crossgen2RootCommand.cs (7)
98new("--targetos") { CustomParser = result => Helpers.GetTargetOS(result.Tokens.Count > 0 ? result.Tokens[0].Value : null), DefaultValueFactory = result => Helpers.GetTargetOS(result.Tokens.Count > 0 ? result.Tokens[0].Value : null), Description = SR.TargetOSOption, HelpName = "arg" }; 369string firstToken = result.Tokens.Count > 0 ? result.Tokens[0].Value : null; 382return int.Parse(result.Tokens[0].Value); 400return result.Tokens[0].Value.ToLowerInvariant() switch 419return result.Tokens[0].Value.ToLowerInvariant() switch 432return result.Tokens[0].Value.ToLowerInvariant() switch
src\runtime\src\coreclr\tools\Common\CommandLineHelpers.cs (2)
34AppendExpandedPaths(dictionary, token.Value, strict); 46AppendExpandedPaths(dictionary, token.Value, false);
dotnet (22)
Commands\Hidden\Parse\ParseCommand.cs (1)
18var tokens = result.Tokens.Skip(1).Select(t => t.Value).ToArray();
Commands\Run\RunCommand.cs (7)
844.Any(static t => t is { Type: TokenType.Argument, Value: "-" }); 871.Select(static t => t.Value) 993if (token.Value == "-p") 1000else if (token.Value == possibleProject && nextTokenMayBeProject) 1006else if (token.Value.StartsWith("-p") && token.Value.EndsWith(possibleProject)) 1020tokensMinusProject.Add(token.Value);
Extensions\ParseResultExtensions.cs (5)
36.Select(t => t.Value); 112parseResult.Tokens.Select(t => t.Value).ToArray().GetSubArguments(); 137ArgumentResult argResult => argResult.Tokens.FirstOrDefault()?.Value, 160var propertyOptions = parseResult.CommandResult.Children.Where(c => GetOptionTokenOrDefault(c)?.Value.Equals(optionString) ?? false); 161var propertyValues = propertyOptions.SelectMany(o => o.Tokens.Select(t => t.Value)).ToArray();
ParserOptionActions.cs (1)
47if (OptionPrecedesSubcommand(parseResult.Tokens.Select(t => t.Value), parseResult.RootSubCommandResult()))
Program.cs (5)
232switchIndicators.Any(i => t.Value.StartsWith(i + o, StringComparison.OrdinalIgnoreCase)))); 336if (parseResult.GetResult(Parser.RootCommand.DotnetSubCommand) is { Tokens: [{ Type: TokenType.Argument, Value: { } } unmatchedCommandOrFile] } 337&& VirtualProjectBuilder.IsValidEntryPointPath(unmatchedCommandOrFile.Value)) 344otherTokens.Add(token.Value); 347parseResult = Parser.Parse(["run", "--file", unmatchedCommandOrFile.Value, .. otherTokens]);
Telemetry\AllowListToSendFirstArgument.cs (1)
29.Where(t => t.Type.Equals(TokenType.Argument)).FirstOrDefault()?.Value ?? null;
Telemetry\AllowListToSendVerbSecondVerbFirstArgument.cs (2)
22var secondVerb = parseResult.Tokens.Where(s => s.Type == TokenType.Command).Skip(1).FirstOrDefault()?.Value ?? ""; 26var firstArgument = parseResult.Tokens.FirstOrDefault(t => t.Type.Equals(TokenType.Argument))?.Value ?? "";
dotnet-sourcelink (1)
dotnet-watch (4)
CommandLine\CommandLineOptions.cs (4)
255arguments.Add(token.Value); 261var dashDashIndex = IndexOf(parseResult.Tokens, t => t.Value == "--"); 329=> optionResult.IdentifierToken?.Value ?? optionResult.Option.Name; 334var dashDashIndex = IndexOf(parseResult.Tokens, t => t.Value == "--");
ilc (10)
ILCompilerRootCommand.cs (8)
166new("--targetos") { CustomParser = result => Helpers.GetTargetOS(result.Tokens.Count > 0 ? result.Tokens[0].Value : null), DefaultValueFactory = result => Helpers.GetTargetOS(result.Tokens.Count > 0 ? result.Tokens[0].Value : null), Description = "Target OS for cross compilation", HelpName = "arg" }; 400string firstToken = result.Tokens.Count > 0 ? result.Tokens[0].Value : null; 413return int.Parse(result.Tokens[0].Value); 431return result.Tokens[0].Value.ToLowerInvariant() switch 441_ => throw new CommandLineException(result.Tokens[0].Value) 450return result.Tokens[0].Value.ToLowerInvariant() switch 454_ => throw new CommandLineException(result.Tokens[0].Value)
src\runtime\src\coreclr\tools\Common\CommandLineHelpers.cs (2)
34AppendExpandedPaths(dictionary, token.Value, strict); 46AppendExpandedPaths(dictionary, token.Value, false);
Microsoft.DotNet.Cli.CommandLine (3)
SpanParsableExtensions.cs (3)
100var tokenToParse = token.Value; 140[var onlyToken] => onlyToken.Value, 141_ => tokenizationResult.Tokens[^1].Value
Microsoft.DotNet.Cli.Definitions (20)
Commands\New\CommandDefinitionExtensions.cs (6)
74if (!string.IsNullOrWhiteSpace(token.Value)) 76wrongTokens.Add($"'{token.Value}'"); 98if (optionResult.IdentifierToken is { } && !string.IsNullOrWhiteSpace(optionResult.IdentifierToken.Value)) 100wrongTokens.Add($"'{optionResult.IdentifierToken.Value}'"); 104if (token is { } t && !string.IsNullOrWhiteSpace(t.Value)) 106wrongTokens.Add($"'{t.Value}'");
Commands\New\SharedOptionsFactory.cs (1)
153foreach (string value in result.Tokens.Select(t => t.Value))
Commands\Pack\PackCommandDefinition.cs (1)
84var value = r.Tokens[0].Value;
Commands\Reference\ReferenceAddCommandDefinition.cs (2)
28var result = arguments.Tokens.TakeWhile(t => !t.Value.StartsWith("-")); 30return result.Select(t => t.Value);
Common\CommonArguments.cs (2)
20CustomParser = argumentResult => ParsePackageIdentityWithVersionSeparator(argumentResult.Tokens[0]?.Value), 29CustomParser = argumentResult => ParsePackageIdentityWithVersionSeparator(argumentResult.Tokens[0]?.Value)!.Value,
Common\CommonOptions.cs (7)
58foreach (var kvp in MSBuildPropertyParser.ParseProperties(token.Value)) 134argumentResult.Tokens.Select(t => t.Value) 313var separator = token.Value.IndexOf('='); 315? (token.Value[0..separator], token.Value[(separator + 1)..]) 316: (token.Value, ""); 335string.Join(", ", invalid.Select(x => $"'{x.Value}'"))));
Help\LocalizationResources.cs (1)
109private static string GetOptionName(OptionResult optionResult) => optionResult.IdentifierToken?.Value ?? optionResult.Option.Name;
Microsoft.TemplateEngine.Cli (31)
ChoiceTemplateParameter.cs (8)
117or.IdentifierToken?.Value, 123argumentResult.AddError(string.Format(LocalizableStrings.ParseTemplateOption_Error_MissingDefaultValue, or.IdentifierToken?.Value)); 136or.IdentifierToken?.Value, 142argumentResult.AddError(string.Format(LocalizableStrings.ParseTemplateOption_Error_MissingDefaultIfNoOptionValue, or.IdentifierToken?.Value)); 148argumentResult.AddError(string.Format(LocalizableStrings.ParseTemplateOption_Error_InvalidCount, or.IdentifierToken?.Value, argumentResult.Tokens.Count)); 153if (!TryConvertValueToChoice(argumentResult.Tokens.Select(t => t.Value), parameter, out string value, out string error)) 158argumentResult.Tokens[0].Value, 159or.IdentifierToken?.Value,
CliTemplateParameter.cs (8)
338or.IdentifierToken?.Value, 346argumentResult.AddError(string.Format(LocalizableStrings.ParseTemplateOption_Error_MissingDefaultValue, or.IdentifierToken?.Value)); 360or.IdentifierToken?.Value, 365argumentResult.AddError(string.Format(LocalizableStrings.ParseTemplateOption_Error_MissingDefaultIfNoOptionValue, or.IdentifierToken?.Value)); 370(bool parsed, T value) = convert(argumentResult.Tokens[0].Value); 378argumentResult.Tokens[0].Value, 379or.IdentifierToken?.Value, 386argumentResult.AddError(string.Format(LocalizableStrings.ParseTemplateOption_Error_InvalidCount, or.IdentifierToken?.Value, argumentResult.Tokens.Count));
Commands\BaseCommand.cs (1)
121string usedCommandAlias = args.ParseResult.CommandResult.IdentifierToken.Value;
Commands\BaseFilterableArgs.cs (1)
42return _filters[filter].IdentifierToken?.Value;
Commands\create\InstantiateCommand.cs (1)
253args.ParseResult.Tokens.Select(t => t.Value).ToArray(),
Commands\create\InstantiateCommand.NoMatchHandling.cs (3)
146IEnumerable<string> tokens = args.ParseResult.Tokens.Select(t => $"'{t.Value}'"); 194baseInputParameters += $", {token.Value}='{optionResult.GetValueOrDefault<string>()}'"; 209Reporter.Error.WriteLine(string.Format(LocalizableStrings.TemplateOptions_Error_AllowedValuesForOptionList, token.Value, allowedValues));
Commands\create\InstantiateCommandArgs.cs (2)
46tokens.Add(token.Value); 48tokens.AddRange(optionResult.Tokens.Select(t => t.Value));
Commands\create\InvalidTemplateOptionResult.cs (2)
96optionValue = string.Join(", ", optionResult.Tokens.Select(t => t.Value)); 102optionResult.IdentifierToken?.Value ?? string.Empty,
Commands\create\TemplateOptionResult.cs (1)
48optionResult.IdentifierToken?.Value ?? string.Empty,
Commands\Example.cs (1)
78var commandParts = parseResult.Tokens.Select(t => t.Value).Prepend(parseResult.RootCommandResult.Command.Name);
Commands\Extensions.cs (2)
71var invalidArguments = optionResult.Tokens.Where(token => !allowedValues.Append(allowedHiddenValue).Contains(token.Value, StringComparer.OrdinalIgnoreCase)).ToList(); 76string.Join(", ", invalidArguments.Select(arg => $"'{arg.Value}'")),
Commands\NewCommandArgs.cs (1)
49.Select(t => t.Value).ToArray();
NuGet.CommandLine.XPlat (12)
Commands\Package\PackageWithNuGetVersion.cs (5)
32int separatorIndex = token.Value.IndexOf('@'); 36packageId = token.Value; 40packageId = token.Value.Substring(0, separatorIndex); 41string versionString = token.Value.Substring(separatorIndex + 1); 45result.AddError(Messages.Error_MissingVersion(token.Value));
Commands\Package\PackageWithVersionRange.cs (5)
32int separatorIndex = token.Value.IndexOf('@'); 35packageId = token.Value; 40packageId = token.Value.Substring(0, separatorIndex); 41string versionString = token.Value.Substring(separatorIndex + 1); 44result.AddError(Messages.Error_MissingVersion(token.Value));
Commands\Why\WhyCommand.cs (2)
79return value.Value; 91var value = ar.Tokens[0].Value;
System.CommandLine (40)
ArgumentValidation.cs (13)
86var invalidCharactersIndex = token.Value.IndexOfAny(invalidFileNameChars); 90result.AddError(LocalizationResources.InvalidCharactersInFileName(token.Value[invalidCharactersIndex])); 114var invalidCharactersIndex = token.Value.IndexOfAny(invalidPathChars); 118result.AddError(LocalizationResources.InvalidCharactersInPath(token.Value[invalidCharactersIndex])); 167if (!values.Contains(token.Value, comparer)) 169argumentResult.AddError(LocalizationResources.UnrecognizedArgument(token.Value, values)); 190if (!Path.Exists(token.Value)) 195result.AddError(LocalizationResources.FileOrDirectoryDoesNotExist(token.Value)); 198else if (checkDirectory && !Directory.Exists(token.Value)) 200result.AddError(LocalizationResources.DirectoryDoesNotExist(token.Value)); 202else if (checkFile && !Directory.Exists(token.Value) && !File.Exists(token.Value)) 204result.AddError(LocalizationResources.FileDoesNotExist(token.Value));
Binding\ArgumentConverter.cs (2)
43var value = token.Value; 144convert(result.Tokens[result.Tokens.Count - 1].Value, out value);
Completions\CompletionAction.cs (1)
27var commandLineToComplete = parseResult.Tokens.LastOrDefault(t => t.Type != TokenType.Directive)?.Value ?? "";
Completions\CompletionContext.cs (1)
77textToMatch = lastToken.Value;
LocalizationResources.cs (2)
59commandResult.IdentifierToken.Value) 257private static string GetOptionName(OptionResult optionResult) => optionResult.IdentifierToken?.Value ?? optionResult.Option.Name;
ParseResult.cs (2)
108=> _unmatchedTokens.Count == 0 ? Array.Empty<string>() : _unmatchedTokens.Select(t => t.Value).ToArray(); 393var tokenToComplete = parseResult.Tokens.Last(t => t.Value == textCompletionContext.WordToComplete);
Parsing\ArgumentResult.cs (2)
142public override string ToString() => $"{nameof(ArgumentResult)} {Argument.Name}: {string.Join(" ", Tokens.Select(t => $"<{t.Value}>"))}"; 226? Tokens[0].Value
Parsing\CommandResult.cs (2)
41public override string ToString() => $"{nameof(CommandResult)}: {IdentifierToken.Value} {string.Join(" ", Tokens.Select(t => t.Value))}";
Parsing\OptionResult.cs (2)
48public override string ToString() => $"{nameof(OptionResult)}: {IdentifierToken?.Value ?? Option.Name} {string.Join(" ", Tokens.Select(t => t.Value))}";
Parsing\ParseDiagramAction.cs (3)
114builder.Append(string.Join("> <", symbolResult.Tokens.Select(t => t.Value))); 142builder.Append(optionResult.IdentifierToken?.Value ?? optionResult.Option.Name); 146builder.Append(((CommandResult)symbolResult).IdentifierToken.Value);
Parsing\ParseOperation.cs (3)
274else if (argument.IsBoolean() && !bool.TryParse(CurrentToken.Value, out _)) 350ReadOnlySpan<char> withoutBrackets = token.Value.AsSpan(1, token.Value.Length - 2);
Parsing\StringExtensions.cs (1)
232tokenList.Add(new Token(found.Value, found.Type, found.Symbol, argumentIndex));
Parsing\SymbolResultTree.cs (1)
75AddError(new ParseError(LocalizationResources.UnrecognizedCommandOrArgument(token.Value), commandResult));
Parsing\Token.cs (4)
55public bool Equals(Token? other) => other is not null && Value == other.Value && Type == other.Type && ReferenceEquals(Symbol, other.Symbol); 58public override int GetHashCode() => Value.GetHashCode() ^ (int)Type; 61public override string ToString() => Value;
VersionOption.cs (1)
58result.AddError(LocalizationResources.VersionOptionCannotBeCombinedWithOtherArguments(result.IdentifierToken?.Value ?? result.Option.Name));
System.CommandLine.StaticCompletions (2)
CompletionsCommandDefinition.cs (2)
32if (!ShellNames.All.Contains(singleToken.Value)) 34argumentResult.AddError(string.Format(Strings.ShellDiscovery_ShellNotSupported, singleToken.Value, string.Join(", ", ShellNames.All)));