File tree Expand file tree Collapse file tree 3 files changed +24
-9
lines changed
tests/ConsoleAppFramework.GeneratorTests Expand file tree Collapse file tree 3 files changed +24
-9
lines changed Original file line number Diff line number Diff line change 11using ConsoleAppFramework ;
22using FilterShareProject ;
3+ using System . Reflection ;
4+
35//using Microsoft.Extensions.DependencyInjection;
46using System . Runtime . CompilerServices ;
57
6-
7- args = [ "Output" ] ;
8-
8+ args = [ "--version" ] ;
9+ Console . WriteLine ( args . Length ) ;
10+ Console . WriteLine ( args . AsSpan ( 0 ) . Length ) ;
911
1012// ConsoleApp.ServiceProvider
1113// ConsoleApp.Create(
1214
1315
16+ // ConsoleApp.Run(args, (int x, int y) => { });
1417var app = ConsoleApp . Create ( ) ;
15-
16- // var app = ConsoleApp.Create();
17-
18- // app.Add<MyCommands>();
19- app . Add < MyCommands > ( ) ;
18+ app . Add < MyCommands > ( "zzz" ) ;
2019
2120app . Run ( args ) ;
2221
Original file line number Diff line number Diff line change @@ -500,7 +500,7 @@ void EmitLeafCommand(CommandWithId? command)
500500 {
501501 if ( command == null )
502502 {
503- sb . AppendLine ( " ShowHelp(-1);") ;
503+ sb . AppendLine ( $ "if (!TryShowHelpOrVersion(args.AsSpan( { depth } ), -1, -1)) ShowHelp(-1);") ;
504504 }
505505 else
506506 {
Original file line number Diff line number Diff line change @@ -34,6 +34,22 @@ public void Version()
3434 expected : """
35359999.9999999abcdefg
3636
37+ """ ) ;
38+ }
39+
40+ [ Fact ]
41+ public void VersionOnBuilder ( )
42+ {
43+ var version = Assembly . GetEntryAssembly ( ) ? . GetCustomAttribute < AssemblyInformationalVersionAttribute > ( ) ? . InformationalVersion ?? "1.0.0" ;
44+
45+ verifier . Execute ( code : """
46+ var app = ConsoleApp.Create();
47+ app.Run(args);
48+ """ ,
49+ args : "--version" ,
50+ expected : $$ """
51+ {{ version }}
52+
3753""" ) ;
3854 }
3955
You can’t perform that action at this time.
0 commit comments