Skip to content

Commit 4562e72

Browse files
authored
rename rename ISuggestionSource.Suggest -> GetSuggestions (#721)
1 parent 6472cd4 commit 4562e72

File tree

8 files changed

+16
-16
lines changed

8 files changed

+16
-16
lines changed

src/System.CommandLine.Benchmarks/CommandLine/Perf_Suggestions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public void Setup_FromSymbol()
5050
[Benchmark]
5151
public void SuggestionsFromSymbol()
5252
{
53-
_testSymbol.Suggest().Consume(new Consumer());
53+
_testSymbol.GetSuggestions().Consume(new Consumer());
5454
}
5555

5656
[GlobalSetup(Target = nameof(SuggestionsFromParseResult))]

src/System.CommandLine.Tests/SuggestionTests.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public void Option_Suggest_returns_argument_suggestions_if_configured()
3333
.WithSuggestions("one", "two", "three")
3434
};
3535

36-
var suggestions = option.Suggest();
36+
var suggestions = option.GetSuggestions();
3737

3838
suggestions.Should().BeEquivalentTo("one", "two", "three");
3939
}
@@ -58,7 +58,7 @@ public void Command_Suggest_returns_available_option_aliases()
5858

5959
var command = command1;
6060

61-
var suggestions = command.Suggest();
61+
var suggestions = command.GetSuggestions();
6262

6363
suggestions.Should().BeEquivalentTo("--one", "--two", "--three");
6464
}
@@ -73,7 +73,7 @@ public void Command_Suggest_returns_available_subcommands()
7373
new Command("three")
7474
};
7575

76-
var suggestions = command.Suggest();
76+
var suggestions = command.GetSuggestions();
7777

7878
suggestions.Should().BeEquivalentTo("one", "two", "three");
7979
}
@@ -87,7 +87,7 @@ public void Command_Suggest_returns_available_subcommands_and_option_aliases()
8787
new Option("--option")
8888
};
8989

90-
var suggestions = command.Suggest();
90+
var suggestions = command.GetSuggestions();
9191

9292
suggestions.Should().BeEquivalentTo("subcommand", "--option");
9393
}
@@ -106,7 +106,7 @@ public void Command_Suggest_returns_available_subcommands_and_option_aliases_and
106106
.WithSuggestions("command-argument")
107107
};
108108

109-
var suggestions = command.Suggest();
109+
var suggestions = command.GetSuggestions();
110110

111111
suggestions.Should()
112112
.BeEquivalentTo("subcommand", "--option", "command-argument");

src/System.CommandLine/Argument.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,15 @@ internal void AddAllowedValues(IEnumerable<string> values)
164164
AllowedValues.UnionWith(values);
165165
}
166166

167-
public override IEnumerable<string> Suggest(string textToMatch)
167+
public override IEnumerable<string> GetSuggestions(string textToMatch)
168168
{
169169
var fixedSuggestions = _suggestions;
170170

171171
var dynamicSuggestions = _suggestionSources
172-
.SelectMany(source => source.Suggest(textToMatch));
172+
.SelectMany(source => source.GetSuggestions(textToMatch));
173173

174174
var typeSuggestions = SuggestionSource.ForType(ArgumentType)
175-
.Suggest(textToMatch);
175+
.GetSuggestions(textToMatch);
176176

177177
return fixedSuggestions
178178
.Concat(dynamicSuggestions)

src/System.CommandLine/Help/HelpBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ protected virtual string ArgumentDescriptor(IArgument argument)
315315
return "";
316316
}
317317

318-
var suggestions = argument.Suggest().ToArray();
318+
var suggestions = argument.GetSuggestions().ToArray();
319319
if (suggestions.Length > 0)
320320
{
321321
return string.Join("|", suggestions);

src/System.CommandLine/Parsing/ParseResultExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ public static IEnumerable<string> Suggestions(
199199

200200
var currentSymbolSuggestions =
201201
currentSymbol is ISuggestionSource currentSuggestionSource
202-
? currentSuggestionSource.Suggest(textToMatch)
202+
? currentSuggestionSource.GetSuggestions(textToMatch)
203203
: Array.Empty<string>();
204204

205205
IEnumerable<string> siblingSuggestions;
@@ -213,7 +213,7 @@ currentSymbol is ISuggestionSource currentSuggestionSource
213213
else
214214
{
215215
siblingSuggestions = parentSymbol
216-
.Suggest(textToMatch)
216+
.GetSuggestions(textToMatch)
217217
.Except(parentSymbol
218218
.Children
219219
.OfType<ICommand>()

src/System.CommandLine/Suggestions/AnonymousSuggestionSource.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public AnonymousSuggestionSource(Suggest suggest)
1414
this.suggest = suggest;
1515
}
1616

17-
public IEnumerable<string> Suggest(string textToMatch = null)
17+
public IEnumerable<string> GetSuggestions(string textToMatch = null)
1818
{
1919
return suggest(textToMatch);
2020
}

src/System.CommandLine/Suggestions/ISuggestionSource.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ namespace System.CommandLine.Suggestions
77
{
88
public interface ISuggestionSource
99
{
10-
IEnumerable<string> Suggest(string textToMatch = null);
10+
IEnumerable<string> GetSuggestions(string textToMatch = null);
1111
}
1212
}

src/System.CommandLine/Symbol.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,12 @@ public bool HasAlias(string alias)
146146

147147
public bool IsHidden { get; set; }
148148

149-
public virtual IEnumerable<string> Suggest(string textToMatch = null)
149+
public virtual IEnumerable<string> GetSuggestions(string textToMatch = null)
150150
{
151151
var argumentSuggestions =
152152
Children
153153
.OfType<IArgument>()
154-
.SelectMany(a => a.Suggest(textToMatch))
154+
.SelectMany(a => a.GetSuggestions(textToMatch))
155155
.ToArray();
156156

157157
return this.ChildSymbolAliases()

0 commit comments

Comments
 (0)