@@ -160,4 +160,47 @@ public void Output(string msg = @"\\")
160160ConsoleApp.Run(args, (string msg = @"\\") => Console.Write(msg));
161161""" , "" , @"\\" ) ;
162162 }
163+
164+ [ Fact ]
165+ public void ShortNameAlias ( )
166+ {
167+ var code = """
168+ var app = ConsoleApp.Create();
169+ app.Add<FileCommand>();
170+ app.Run(args);
171+
172+ public class FileCommand
173+ {
174+ /// <summary>Outputs the provided file name.</summary>
175+ /// <param name="inputFile">-i, InputFile</param>
176+ [Command("")]
177+ public void Run(string inputFile) => Console.Write(inputFile);
178+ }
179+ """ ;
180+
181+ verifier . Execute ( code , "--input-file sample.txt" , "sample.txt" ) ;
182+ verifier . Execute ( code , "-i sample.txt" , "sample.txt" ) ;
183+ }
184+
185+ [ Fact ]
186+ public void ShortNameAndLongNameAlias ( )
187+ {
188+ var code = """
189+ var app = ConsoleApp.Create();
190+ app.Add<FileCommand>();
191+ app.Run(args);
192+
193+ public class FileCommand
194+ {
195+ /// <summary>Outputs the provided file name.</summary>
196+ /// <param name="inputFile">-i|--input, InputFile</param>
197+ [Command("")]
198+ public void Run(string inputFile) => Console.Write(inputFile);
199+ }
200+ """ ;
201+
202+ verifier . Execute ( code , "--input-file sample.txt" , "sample.txt" ) ;
203+ verifier . Execute ( code , "--input sample.txt" , "sample.txt" ) ;
204+ verifier . Execute ( code , "-i sample.txt" , "sample.txt" ) ;
205+ }
163206}
0 commit comments