123 references to Tokens
Aspire.RuntimeIdentifier.Tool (1)
Program.cs (1)
79foreach (var token in result.Tokens)
crossgen2 (21)
Crossgen2RootCommand.cs (21)
20new("input-file-path") { CustomParser = result => Helpers.BuildPathDictionary(result.Tokens, true), Description = "Input file(s)", Arity = ArgumentArity.OneOrMore }; 22new("--unrooted-input-file-paths", "-u") { CustomParser = result => Helpers.BuildPathDictionary(result.Tokens, true), DefaultValueFactory = result => Helpers.BuildPathDictionary(result.Tokens, true), Description = SR.UnrootedInputFilesToCompile }; 24new("--reference", "-r") { CustomParser = result => Helpers.BuildPathDictionary(result.Tokens, false), DefaultValueFactory = result => Helpers.BuildPathDictionary(result.Tokens, false), Description = SR.ReferenceFiles }; 52new("--inputbubbleref") { CustomParser = result => Helpers.BuildPathDictionary(result.Tokens, false), DefaultValueFactory = result => Helpers.BuildPathDictionary(result.Tokens, false), Description = SR.InputBubbleReferenceFiles }; 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; 381if (result.Tokens.Count > 0) 382return int.Parse(result.Tokens[0].Value); 397if (result.Tokens.Count == 0 ) 400return result.Tokens[0].Value.ToLowerInvariant() switch 416if (result.Tokens.Count == 0 ) 419return result.Tokens[0].Value.ToLowerInvariant() switch 429if (result.Tokens.Count == 0) 432return result.Tokens[0].Value.ToLowerInvariant() switch
dotnet (5)
Extensions\ParseResultExtensions.cs (2)
137ArgumentResult argResult => argResult.Tokens.FirstOrDefault()?.Value, 161var propertyValues = propertyOptions.SelectMany(o => o.Tokens.Select(t => t.Value)).ToArray();
Program.cs (2)
230var skipFirstTimeUseCheck = parseResult.CommandResult.Tokens.Any(t => 336if (parseResult.GetResult(Parser.RootCommand.DotnetSubCommand) is { Tokens: [{ Type: TokenType.Argument, Value: { } } unmatchedCommandOrFile] }
Telemetry\AllowListToSendFirstArgument.cs (1)
28var firstArgument = parseResult.RootCommandResult.Children.FirstOrDefault()?.Tokens
dotnet-sourcelink (1)
dotnet-watch (2)
CommandLine\CommandLineOptions.cs (2)
246if (optionResult.Tokens.Count == 0 && !optionResult.Implicit) 252foreach (var token in optionResult.Tokens)
ilc (17)
ILCompilerRootCommand.cs (17)
18new("input-file-path") { CustomParser = result => Helpers.BuildPathDictionary(result.Tokens, true), Description = "Input file(s)", Arity = ArgumentArity.OneOrMore }; 20new("--reference", "-r") { CustomParser = result => Helpers.BuildPathDictionary(result.Tokens, false), DefaultValueFactory = result => Helpers.BuildPathDictionary(result.Tokens, false), Description = "Reference file(s) for compilation" }; 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; 412if (result.Tokens.Count > 0) 413return int.Parse(result.Tokens[0].Value); 428if (result.Tokens.Count == 0) 431return result.Tokens[0].Value.ToLowerInvariant() switch 441_ => throw new CommandLineException(result.Tokens[0].Value) 447if (result.Tokens.Count == 0) 450return result.Tokens[0].Value.ToLowerInvariant() switch 454_ => throw new CommandLineException(result.Tokens[0].Value)
Microsoft.DotNet.Cli.CommandLine (6)
SpanParsableExtensions.cs (6)
83if (tokenizationResult.Tokens.Count == 0) 96var coll = ImmutableArray.CreateBuilder<T>(tokenizationResult.Tokens.Count); 98foreach (var token in tokenizationResult.Tokens) 123if (tokenizationResult.Tokens.Count == 0) 138tokenizationResult.Tokens switch 141_ => tokenizationResult.Tokens[^1].Value
Microsoft.DotNet.Cli.Definitions (13)
Commands\New\CommandDefinitionExtensions.cs (2)
72foreach (var token in newCommandArgument.Tokens) 102foreach (var token in optionResult.Tokens)
Commands\New\SharedOptionsFactory.cs (1)
153foreach (string value in result.Tokens.Select(t => t.Value))
Commands\Pack\PackCommandDefinition.cs (2)
82if (r.Tokens.Count == 0) 84var value = r.Tokens[0].Value;
Commands\Reference\ReferenceAddCommandDefinition.cs (1)
28var result = arguments.Tokens.TakeWhile(t => !t.Value.StartsWith("-"));
Common\CommonArguments.cs (2)
20CustomParser = argumentResult => ParsePackageIdentityWithVersionSeparator(argumentResult.Tokens[0]?.Value), 29CustomParser = argumentResult => ParsePackageIdentityWithVersionSeparator(argumentResult.Tokens[0]?.Value)!.Value,
Common\CommonOptions.cs (5)
51if (result.Tokens.Count == 0) 56foreach (var token in result.Tokens) 129if (argumentResult.Tokens.Count == 0) 134argumentResult.Tokens.Select(t => t.Value) 311foreach (var token in argumentResult.Tokens)
Microsoft.TemplateEngine.Cli (16)
ChoiceTemplateParameter.cs (5)
103if (argumentResult.Tokens.Count == 0) 145else if (!parameter.AllowMultipleValues && argumentResult.Tokens.Count != 1) 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,
CliTemplateParameter.cs (5)
322if (argumentResult.Tokens.Count == 0) 368else if (argumentResult.Tokens.Count == 1) 370(bool parsed, T value) = convert(argumentResult.Tokens[0].Value); 378argumentResult.Tokens[0].Value, 386argumentResult.AddError(string.Format(LocalizableStrings.ParseTemplateOption_Error_InvalidCount, or.IdentifierToken?.Value, argumentResult.Tokens.Count));
Commands\create\InstantiateCommandArgs.cs (1)
48tokens.AddRange(optionResult.Tokens.Select(t => t.Value));
Commands\create\InvalidTemplateOptionResult.cs (2)
94if (optionResult.Tokens.Any()) 96optionValue = string.Join(", ", optionResult.Tokens.Select(t => t.Value));
Commands\Extensions.cs (1)
71var invalidArguments = optionResult.Tokens.Where(token => !allowedValues.Append(allowedHiddenValue).Contains(token.Value, StringComparer.OrdinalIgnoreCase)).ToList();
Commands\NewCommandArgs.cs (2)
40tokensToEvaluate.AddRange(o.Tokens); 44tokensToEvaluate.AddRange(childrenResult.Tokens);
NuGet.CommandLine.XPlat (10)
Commands\Package\PackageWithNuGetVersion.cs (3)
20if (result.Tokens.Count == 0) 25var packages = new List<PackageWithNuGetVersion>(result.Tokens.Count); 27foreach (var token in result.Tokens)
Commands\Package\PackageWithVersionRange.cs (3)
21if (result.Tokens.Count == 0) 26List<PackageWithVersionRange> packages = new List<PackageWithVersionRange>(result.Tokens.Count); 28foreach (var token in result.Tokens)
Commands\Why\WhyCommand.cs (4)
77var value = ar.Tokens[0]; 89if (ar.Tokens.Count == 1) 91var value = ar.Tokens[0].Value; 95return ar.Tokens.Count > 1;
System.CommandLine (29)
ArgumentArity.cs (1)
85int tokenCount = argumentResult.Tokens.Count;
ArgumentValidation.cs (8)
83for (var i = 0; i < result.Tokens.Count; i++) 85var token = result.Tokens[i]; 108for (var i = 0; i < result.Tokens.Count; i++) 110var token = result.Tokens[i]; 161for (var i = 0; i < argumentResult.Tokens.Count; i++) 163var token = argumentResult.Tokens[i]; 183for (var i = 0; i < result.Tokens.Count; i++) 185var token = result.Tokens[i];
Binding\ArgumentConverter.cs (7)
27if (argumentResult.Tokens.Count == 0) 144convert(result.Tokens[result.Tokens.Count - 1].Value, out value); 223argumentResult.Tokens.Count > 0 224? argumentResult.Tokens[argumentResult.Tokens.Count - 1] 228argumentResult.Tokens)
LocalizationResources.cs (1)
20=> GetResourceString(Properties.Resources.OptionExpectsOneArgument, GetOptionName(optionResult), optionResult.Tokens.Count);
ParseResult.cs (1)
395return optionResult.Tokens.Contains(tokenToComplete);
Parsing\ArgumentResult.cs (4)
142public override string ToString() => $"{nameof(ArgumentResult)} {Argument.Name}: {string.Join(" ", Tokens.Select(t => $"<{t.Value}>"))}"; 199_ => ArgumentConversionResult.Success(this, Tokens) 225Tokens.Count > 0 226? Tokens[0].Value
Parsing\CommandResult.cs (2)
41public override string ToString() => $"{nameof(CommandResult)}: {IdentifierToken.Value} {string.Join(" ", Tokens.Select(t => t.Value))}"; 44=> argumentResult.Argument.HasDefaultValue && argumentResult.Tokens.Count == 0;
Parsing\OptionResult.cs (4)
48public override string ToString() => $"{nameof(OptionResult)}: {IdentifierToken?.Value ?? Option.Name} {string.Join(" ", Tokens.Select(t => t.Value))}"; 58=> Option.Argument.Arity.MaximumNumberOfValues == (Implicit ? Tokens.Count - 1 : Tokens.Count); 70return Tokens.Count is 0 &&
Parsing\ParseDiagramAction.cs (1)
114builder.Append(string.Join("> <", symbolResult.Tokens.Select(t => t.Value)));
System.CommandLine.StaticCompletions (2)
CompletionsCommandDefinition.cs (2)
26if (argumentResult.Tokens.Count == 0) 31var singleToken = argumentResult.Tokens[0];