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 1
1
using System ;
2
+ using System . Diagnostics . CodeAnalysis ;
2
3
using System . IO ;
3
4
using System . Linq ;
4
5
5
6
namespace XmlSchemaClassGenerator
6
7
{
7
8
public class CommandLineArgumentsProvider
8
9
{
9
- public virtual string CommandLineArguments
10
+ public CommandLineArgumentsProvider ( string commandLineArguments )
10
11
{
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 ) ;
16
22
}
17
23
}
18
24
}
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ public GeneratorConfiguration()
38
38
NamingProvider = new NamingProvider ( NamingScheme ) ;
39
39
Version = VersionProvider . CreateFromAssembly ( ) ;
40
40
EnableUpaCheck = true ;
41
- CommandLineArgumentsProvider = new CommandLineArgumentsProvider ( ) ;
41
+ CommandLineArgumentsProvider = CommandLineArgumentsProvider . CreateFromEnvironment ( ) ;
42
42
}
43
43
44
44
/// <summary>
You can’t perform that action at this time.
0 commit comments