@@ -63,22 +63,26 @@ public static string? ConfigFile
6363 // _configFileOption.Validators.Add(input => { ... });
6464 }
6565
66- var result = _configFileOption . Parse ( Environment . GetCommandLineArgs ( ) ) ;
67- // since we're parsing all args, and other options are not instantiated yet
68- // we're getting here a bunch of other errors, so we only need to look for
69- // errors related to the config file option
70- var error = result . Errors . FirstOrDefault ( e => e . SymbolResult ? . Symbol == _configFileOption ) ;
71- if ( error is not null )
72- {
73- // Logger is not available here yet so we need to fallback to Console
74- var color = Console . ForegroundColor ;
75- Console . ForegroundColor = ConsoleColor . Red ;
76- Console . Error . WriteLine ( error . Message ) ;
77- Console . ForegroundColor = color ;
78- Environment . Exit ( 1 ) ;
79- }
80-
81- var configFile = result . GetValueForOption ( _configFileOption ) ;
66+ // TODO: Fix early parsing for beta5 - Options no longer have Parse method
67+ // var result = _configFileOption.Parse(Environment.GetCommandLineArgs());
68+ // // since we're parsing all args, and other options are not instantiated yet
69+ // // we're getting here a bunch of other errors, so we only need to look for
70+ // // errors related to the config file option
71+ // var error = result.Errors.FirstOrDefault(e => e.SymbolResult?.Symbol == _configFileOption);
72+ // if (error is not null)
73+ // {
74+ // // Logger is not available here yet so we need to fallback to Console
75+ // var color = Console.ForegroundColor;
76+ // Console.ForegroundColor = ConsoleColor.Red;
77+ // Console.Error.WriteLine(error.Message);
78+ // Console.ForegroundColor = color;
79+ // Environment.Exit(1);
80+ // }
81+
82+ // TODO: Fix config file path extraction for beta5
83+ var configFile = Environment . GetCommandLineArgs ( )
84+ . Where ( arg => arg . StartsWith ( "--config-file=" ) || arg . StartsWith ( "-c=" ) )
85+ . FirstOrDefault ( ) ? . Split ( '=' , 2 ) . LastOrDefault ( ) ;
8286 return configFile is not null ?
8387 Path . GetFullPath ( ProxyUtils . ReplacePathTokens ( configFile ) ) :
8488 null ;
@@ -111,22 +115,24 @@ public static LogLevel? LogLevel
111115 // _logLevelOption.Validators.Add(input => { ... });
112116 }
113117
114- var result = _logLevelOption . Parse ( Environment . GetCommandLineArgs ( ) ) ;
115- // since we're parsing all args, and other options are not instantiated yet
116- // we're getting here a bunch of other errors, so we only need to look for
117- // errors related to the log level option
118- var error = result . Errors . FirstOrDefault ( e => e . SymbolResult ? . Symbol == _logLevelOption ) ;
119- if ( error is not null )
120- {
121- // Logger is not available here yet so we need to fallback to Console
122- var color = Console . ForegroundColor ;
123- Console . ForegroundColor = ConsoleColor . Red ;
124- Console . Error . WriteLine ( error . Message ) ;
125- Console . ForegroundColor = color ;
126- Environment . Exit ( 1 ) ;
127- }
128-
129- _logLevel = result . GetValueForOption ( _logLevelOption ) ;
118+ // TODO: Fix early parsing for beta5 - Options no longer have Parse method
119+ // var result = _logLevelOption.Parse(Environment.GetCommandLineArgs());
120+ // // since we're parsing all args, and other options are not instantiated yet
121+ // // we're getting here a bunch of other errors, so we only need to look for
122+ // // errors related to the log level option
123+ // var error = result.Errors.FirstOrDefault(e => e.SymbolResult?.Symbol == _logLevelOption);
124+ // if (error is not null)
125+ // {
126+ // // Logger is not available here yet so we need to fallback to Console
127+ // var color = Console.ForegroundColor;
128+ // Console.ForegroundColor = ConsoleColor.Red;
129+ // Console.Error.WriteLine(error.Message);
130+ // Console.ForegroundColor = color;
131+ // Environment.Exit(1);
132+ // }
133+
134+ // TODO: Fix log level extraction for beta5
135+ _logLevel = null ; // Default fallback until parsing is fixed
130136 _logLevelResolved = true ;
131137
132138 return _logLevel ;
@@ -156,22 +162,24 @@ public static string? IPAddress
156162 // _ipAddressOption.Validators.Add(input => { ... });
157163 }
158164
159- var result = _ipAddressOption . Parse ( Environment . GetCommandLineArgs ( ) ) ;
160- // since we're parsing all args, and other options are not instantiated yet
161- // we're getting here a bunch of other errors, so we only need to look for
162- // errors related to the log level option
163- var error = result . Errors . FirstOrDefault ( e => e . SymbolResult ? . Symbol == _ipAddressOption ) ;
164- if ( error is not null )
165- {
166- // Logger is not available here yet so we need to fallback to Console
167- var color = Console . ForegroundColor ;
168- Console . ForegroundColor = ConsoleColor . Red ;
169- Console . Error . WriteLine ( error . Message ) ;
170- Console . ForegroundColor = color ;
171- Environment . Exit ( 1 ) ;
172- }
173-
174- _ipAddress = result . GetValueForOption ( _ipAddressOption ) ;
165+ // TODO: Fix early parsing for beta5 - Options no longer have Parse method
166+ // var result = _ipAddressOption.Parse(Environment.GetCommandLineArgs());
167+ // // since we're parsing all args, and other options are not instantiated yet
168+ // // we're getting here a bunch of other errors, so we only need to look for
169+ // // errors related to the log level option
170+ // var error = result.Errors.FirstOrDefault(e => e.SymbolResult?.Symbol == _ipAddressOption);
171+ // if (error is not null)
172+ // {
173+ // // Logger is not available here yet so we need to fallback to Console
174+ // var color = Console.ForegroundColor;
175+ // Console.ForegroundColor = ConsoleColor.Red;
176+ // Console.Error.WriteLine(error.Message);
177+ // Console.ForegroundColor = color;
178+ // Environment.Exit(1);
179+ // }
180+
181+ // TODO: Fix IP address extraction for beta5
182+ _ipAddress = null ; // Default fallback until parsing is fixed
175183 _ipAddressResolved = true ;
176184
177185 return _ipAddress ;
@@ -203,7 +211,8 @@ public static List<string>? UrlsToWatch
203211 _urlsToWatchOption . AddAlias ( "-u" ) ;
204212 }
205213
206- var result = _urlsToWatchOption ! . Parse ( Environment . GetCommandLineArgs ( ) ) ;
214+ // TODO: Fix early parsing for beta5 - Options no longer have Parse method
215+ // var result = _urlsToWatchOption!.Parse(Environment.GetCommandLineArgs());
207216 // since we're parsing all args, and other options are not instantiated yet
208217 // we're getting here a bunch of other errors, so we only need to look for
209218 // errors related to the log level option
@@ -218,7 +227,8 @@ public static List<string>? UrlsToWatch
218227 Environment . Exit ( 1 ) ;
219228 }
220229
221- urlsToWatch = result . GetValueForOption ( _urlsToWatchOption ! ) ;
230+ // TODO: Fix URLs to watch extraction for beta5
231+ urlsToWatch = null ; // Default fallback until parsing is fixed
222232 if ( urlsToWatch is not null && urlsToWatch . Count == 0 )
223233 {
224234 urlsToWatch = null ;
0 commit comments