@@ -10,11 +10,9 @@ public static IConfigurationBuilder AddJ4JCommandLine(
1010 string cmdLine ,
1111 MasterTextCollection masterText ,
1212 IAllocator allocator ,
13- CommandLineLogger logger ,
14- out OptionCollection options )
13+ OptionCollection options ,
14+ CommandLineLogger logger )
1515 {
16- options = new OptionCollection ( masterText , logger ) ;
17-
1816 builder . Add ( new J4JCommandLineSource ( options , cmdLine , allocator ) ) ;
1917
2018 return builder ;
@@ -28,46 +26,50 @@ public static IConfigurationBuilder AddJ4JCommandLineWindows(
2826 IAllocator ? allocator = null )
2927 {
3028 logger = new CommandLineLogger ( ) ;
29+
30+ var mt = MasterTextCollection . GetWindowsDefault ( ) ;
3131
3232 allocator ??= new Allocator (
33- new ElementTerminator ( MasterTextCollection . WindowsDefault , logger ) ,
34- new KeyPrefixer ( MasterTextCollection . WindowsDefault , logger ) ,
33+ new ElementTerminator ( mt , logger ) ,
34+ new KeyPrefixer ( mt , logger ) ,
3535 logger ) ;
36-
37- builder . AddJ4JCommandLine (
38- cmdLine ,
39- MasterTextCollection . WindowsDefault ,
40- allocator ,
41- logger ,
42- out var innerOptions ) ;
4336
44- options = innerOptions ;
37+ options = new OptionCollection ( mt , logger ) ;
38+
39+ builder . AddJ4JCommandLine (
40+ cmdLine ,
41+ mt ,
42+ allocator ,
43+ options ,
44+ logger ) ;
4545
4646 return builder ;
4747 }
4848
4949 public static IConfigurationBuilder AddJ4JCommandLineWindows (
5050 this IConfigurationBuilder builder ,
5151 string cmdLine ,
52- out IAllocator allocator ,
5352 out OptionCollection options ,
54- out CommandLineLogger logger )
53+ out IAllocator allocator ,
54+ out CommandLineLogger logger )
5555 {
5656 logger = new CommandLineLogger ( ) ;
5757
58+ var mt = MasterTextCollection . GetWindowsDefault ( ) ;
59+
5860 allocator = new Allocator (
59- new ElementTerminator ( MasterTextCollection . WindowsDefault , logger ) ,
60- new KeyPrefixer ( MasterTextCollection . WindowsDefault , logger ) ,
61+ new ElementTerminator ( mt , logger ) ,
62+ new KeyPrefixer ( mt , logger ) ,
6163 logger ) ;
6264
65+ options = new OptionCollection ( mt , logger ) ;
66+
6367 builder . AddJ4JCommandLine (
6468 cmdLine ,
65- MasterTextCollection . WindowsDefault ,
69+ mt ,
6670 allocator ,
67- logger ,
68- out var innerOptions ) ;
69-
70- options = innerOptions ;
71+ options ,
72+ logger ) ;
7173
7274 return builder ;
7375 }
@@ -81,47 +83,52 @@ public static IConfigurationBuilder AddJ4JCommandLineLinux(
8183 {
8284 logger = new CommandLineLogger ( ) ;
8385
86+ var mt = MasterTextCollection . GetLinuxDefault ( ) ;
87+
8488 allocator ??= new Allocator (
85- new ElementTerminator ( MasterTextCollection . LinuxDefault , logger ) ,
86- new KeyPrefixer ( MasterTextCollection . LinuxDefault , logger ) ,
89+ new ElementTerminator ( mt , logger ) ,
90+ new KeyPrefixer ( mt , logger ) ,
8791 logger ) ;
8892
93+ options = new OptionCollection ( mt , logger ) ;
94+
8995 builder . AddJ4JCommandLine (
9096 cmdLine ,
91- MasterTextCollection . LinuxDefault ,
97+ mt ,
9298 allocator ,
93- logger ,
94- out var innerOptions ) ;
95-
96- options = innerOptions ;
99+ options ,
100+ logger ) ;
97101
98102 return builder ;
99103 }
100104
101105 public static IConfigurationBuilder AddJ4JCommandLineLinux (
102106 this IConfigurationBuilder builder ,
103107 string cmdLine ,
104- out IAllocator allocator ,
105108 out OptionCollection options ,
109+ out IAllocator allocator ,
106110 out CommandLineLogger logger )
107111 {
108112 logger = new CommandLineLogger ( ) ;
109113
114+ var mt = MasterTextCollection . GetLinuxDefault ( ) ;
115+
110116 allocator = new Allocator (
111- new ElementTerminator ( MasterTextCollection . LinuxDefault , logger ) ,
112- new KeyPrefixer ( MasterTextCollection . LinuxDefault , logger ) ,
117+ new ElementTerminator ( mt , logger ) ,
118+ new KeyPrefixer ( mt , logger ) ,
113119 logger ) ;
114120
121+ options = new OptionCollection ( mt , logger ) ;
122+
115123 builder . AddJ4JCommandLine (
116124 cmdLine ,
117- MasterTextCollection . LinuxDefault ,
125+ mt ,
118126 allocator ,
119- logger ,
120- out var innerOptions ) ;
121-
122- options = innerOptions ;
127+ options ,
128+ logger ) ;
123129
124130 return builder ;
125131 }
132+
126133 }
127134}
0 commit comments