File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed
System.CommandLine/Parsing Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -215,6 +215,34 @@ public void When_a_subcommand_has_been_specified_then_its_sibling_commands_will_
215
215
. NotContain ( new [ ] { "apple" , "banana" , "cherry" } ) ;
216
216
}
217
217
218
+ [ Fact ]
219
+ public void When_a_subcommand_has_been_specified_then_its_sibling_commands_aliases_will_not_be_suggested ( )
220
+ {
221
+ var apple = new Command ( "apple" )
222
+ {
223
+ new Option ( "--cortland" )
224
+ } ;
225
+ apple . AddAlias ( "apl" ) ;
226
+
227
+ var banana = new Command ( "banana" )
228
+ {
229
+ new Option ( "--cavendish" )
230
+ } ;
231
+ banana . AddAlias ( "bnn" ) ;
232
+
233
+ var rootCommand = new RootCommand
234
+ {
235
+ apple ,
236
+ banana
237
+ } ;
238
+
239
+ var result = rootCommand . Parse ( "banana " ) ;
240
+
241
+ result . GetSuggestions ( )
242
+ . Should ( )
243
+ . NotContain ( new [ ] { "apl" , "bnn" } ) ;
244
+ }
245
+
218
246
[ Fact ]
219
247
public void When_a_subcommand_has_been_specified_then_its_sibling_options_will_be_suggested ( )
220
248
{
Original file line number Diff line number Diff line change @@ -234,7 +234,7 @@ currentSymbol is ISuggestionSource currentSuggestionSource
234
234
. Except ( parentSymbol
235
235
. Children
236
236
. OfType < ICommand > ( )
237
- . Select ( c => c . Name ) ) ;
237
+ . SelectMany ( c => c . RawAliases ) ) ;
238
238
}
239
239
240
240
if ( currentSymbolResult is CommandResult commandResult )
You can’t perform that action at this time.
0 commit comments