@@ -278,4 +278,38 @@ public override Task InvokeAsync(ConsoleAppContext context,CancellationToken can
278278
279279 verifier . Execute ( code , "nomunomu" , "filter1-filter2-command" ) ;
280280 }
281+
282+ [ Fact ]
283+ public void CommandAlias ( )
284+ {
285+ var code = """
286+ var app = ConsoleApp.Create();
287+
288+ app.Add("build|b", () => { Console.Write("build ok"); });
289+ app.Add("test|t", () => { Console.Write("test ok"); });
290+ app.Add<Commands>();
291+
292+ app.Run(args);
293+
294+ public class Commands
295+ {
296+ /// <summary>Analyze the current package and report errors, but don't build object files.</summary>
297+ [Command("check|c")]
298+ public void Check() { Console.Write("check ok"); }
299+
300+ /// <summary>Build this packages's and its dependencies' documenation.</summary>
301+ [Command("doc|d")]
302+ public void Doc() { Console.Write("doc ok"); }
303+ }
304+ """ ;
305+
306+ verifier . Execute ( code , "b" , "build ok" ) ;
307+ verifier . Execute ( code , "build" , "build ok" ) ;
308+ verifier . Execute ( code , "t" , "test ok" ) ;
309+ verifier . Execute ( code , "test" , "test ok" ) ;
310+ verifier . Execute ( code , "c" , "check ok" ) ;
311+ verifier . Execute ( code , "check" , "check ok" ) ;
312+ verifier . Execute ( code , "d" , "doc ok" ) ;
313+ verifier . Execute ( code , "doc" , "doc ok" ) ;
314+ }
281315}
0 commit comments