1- using System . Runtime . InteropServices . ComTypes ;
2- using Microsoft . Extensions . Configuration ;
1+ using Microsoft . Extensions . Configuration ;
32
43namespace J4JSoftware . CommandLine
54{
@@ -8,127 +7,11 @@ public static class J4JCommandLineExtensions
87 public static IConfigurationBuilder AddJ4JCommandLine (
98 this IConfigurationBuilder builder ,
109 string cmdLine ,
11- MasterTextCollection masterText ,
12- IAllocator allocator ,
13- OptionCollection options ,
14- CommandLineLogger logger )
10+ OptionCollection options )
1511 {
16- builder . Add ( new J4JCommandLineSource ( options , cmdLine , allocator ) ) ;
12+ builder . Add ( new J4JCommandLineSource ( options , cmdLine ) ) ;
1713
1814 return builder ;
1915 }
20-
21- public static IConfigurationBuilder AddJ4JCommandLineWindows (
22- this IConfigurationBuilder builder ,
23- string cmdLine ,
24- out OptionCollection options ,
25- out CommandLineLogger logger ,
26- IAllocator ? allocator = null )
27- {
28- logger = new CommandLineLogger ( ) ;
29-
30- var mt = MasterTextCollection . GetDefault ( CommandLineStyle . Windows ) ;
31-
32- allocator ??= new Allocator (
33- new ElementTerminator ( mt , logger ) ,
34- new KeyPrefixer ( mt , logger ) ,
35- logger ) ;
36-
37- options = new OptionCollection ( mt , logger ) ;
38-
39- builder . AddJ4JCommandLine (
40- cmdLine ,
41- mt ,
42- allocator ,
43- options ,
44- logger ) ;
45-
46- return builder ;
47- }
48-
49- public static IConfigurationBuilder AddJ4JCommandLineWindows (
50- this IConfigurationBuilder builder ,
51- string cmdLine ,
52- out OptionCollection options ,
53- out IAllocator allocator ,
54- out CommandLineLogger logger )
55- {
56- logger = new CommandLineLogger ( ) ;
57-
58- var mt = MasterTextCollection . GetDefault ( CommandLineStyle . Windows ) ;
59-
60- allocator = new Allocator (
61- new ElementTerminator ( mt , logger ) ,
62- new KeyPrefixer ( mt , logger ) ,
63- logger ) ;
64-
65- options = new OptionCollection ( mt , logger ) ;
66-
67- builder . AddJ4JCommandLine (
68- cmdLine ,
69- mt ,
70- allocator ,
71- options ,
72- logger ) ;
73-
74- return builder ;
75- }
76-
77- public static IConfigurationBuilder AddJ4JCommandLineLinux (
78- this IConfigurationBuilder builder ,
79- string cmdLine ,
80- out OptionCollection options ,
81- out CommandLineLogger logger ,
82- IAllocator ? allocator = null )
83- {
84- logger = new CommandLineLogger ( ) ;
85-
86- var mt = MasterTextCollection . GetDefault ( CommandLineStyle . Linux ) ;
87-
88- allocator ??= new Allocator (
89- new ElementTerminator ( mt , logger ) ,
90- new KeyPrefixer ( mt , logger ) ,
91- logger ) ;
92-
93- options = new OptionCollection ( mt , logger ) ;
94-
95- builder . AddJ4JCommandLine (
96- cmdLine ,
97- mt ,
98- allocator ,
99- options ,
100- logger ) ;
101-
102- return builder ;
103- }
104-
105- public static IConfigurationBuilder AddJ4JCommandLineLinux (
106- this IConfigurationBuilder builder ,
107- string cmdLine ,
108- out OptionCollection options ,
109- out IAllocator allocator ,
110- out CommandLineLogger logger )
111- {
112- logger = new CommandLineLogger ( ) ;
113-
114- var mt = MasterTextCollection . GetDefault ( CommandLineStyle . Linux ) ;
115-
116- allocator = new Allocator (
117- new ElementTerminator ( mt , logger ) ,
118- new KeyPrefixer ( mt , logger ) ,
119- logger ) ;
120-
121- options = new OptionCollection ( mt , logger ) ;
122-
123- builder . AddJ4JCommandLine (
124- cmdLine ,
125- mt ,
126- allocator ,
127- options ,
128- logger ) ;
129-
130- return builder ;
131- }
132-
13316 }
13417}
0 commit comments