File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed
Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change 11using System ;
2+ using System . Diagnostics . CodeAnalysis ;
23using System . IO ;
34using System . Linq ;
45
56namespace XmlSchemaClassGenerator
67{
78 public class CommandLineArgumentsProvider
89 {
9- public virtual string CommandLineArguments
10+ public CommandLineArgumentsProvider ( string commandLineArguments )
1011 {
11- get
12- {
13- var args = Environment . GetCommandLineArgs ( ) ;
14- return string . Join ( " " , args . Take ( 1 ) . Select ( Path . GetFileNameWithoutExtension ) . Concat ( args . Skip ( 1 ) ) . Select ( Extensions . QuoteIfNeeded ) ) ;
15- }
12+ CommandLineArguments = commandLineArguments ?? throw new ArgumentNullException ( nameof ( commandLineArguments ) ) ;
13+ }
14+
15+ public string CommandLineArguments { get ; }
16+
17+ public static CommandLineArgumentsProvider CreateFromEnvironment ( )
18+ {
19+ var args = Environment . GetCommandLineArgs ( ) ;
20+ var commandLineArguments = string . Join ( " " , args . Take ( 1 ) . Select ( Path . GetFileNameWithoutExtension ) . Concat ( args . Skip ( 1 ) ) . Select ( Extensions . QuoteIfNeeded ) ) ;
21+ return new CommandLineArgumentsProvider ( commandLineArguments ) ;
1622 }
1723 }
1824}
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ public GeneratorConfiguration()
3838 NamingProvider = new NamingProvider ( NamingScheme ) ;
3939 Version = VersionProvider . CreateFromAssembly ( ) ;
4040 EnableUpaCheck = true ;
41- CommandLineArgumentsProvider = new CommandLineArgumentsProvider ( ) ;
41+ CommandLineArgumentsProvider = CommandLineArgumentsProvider . CreateFromEnvironment ( ) ;
4242 }
4343
4444 /// <summary>
You can’t perform that action at this time.
0 commit comments