@@ -122,58 +122,102 @@ fn run() -> Result<(), Error> {
122122 }
123123 }
124124 for arg in args {
125- let split: Vec < & str > = arg. split ( '=' ) . collect ( ) ;
126- let key = String :: from ( split[ 0 ] ) ;
127- let mut v = String :: from ( "" ) ;
128- if split. len ( ) == 2 {
129- v = String :: from ( split[ 1 ] ) ;
130- }
131-
132- let flag_val = key. to_lowercase ( ) . replace ( "--" , "-" ) ;
125+ let flag_val = arg. to_lowercase ( ) . replace ( "--" , "-" ) ;
133126 if flag_val == "-h" || flag_val == "-help" {
134127 help ( ) ;
135128 return Ok ( ( ) ) ;
136129 } else if flag_val. starts_with ( "-cd" ) || flag_val. starts_with ( "-wd" ) {
130+ let mut v = arg
131+ . replace ( "--cd" , "" )
132+ . replace ( "--wd" , "" )
133+ . replace ( "-cd" , "" )
134+ . replace ( "-wd" , "" )
135+ . replace ( "\" " , "" )
136+ . replace ( "\' " , "" ) ;
137+ if v. starts_with ( "=" ) {
138+ v = v[ 1 ..v. len ( ) ] . to_string ( ) ;
139+ }
137140 if v. trim ( ) . is_empty ( ) {
138141 finding_working_dir = true ;
139142 }
140143 if !v. ends_with ( sep) {
141144 v. push_str ( sep) ;
142145 }
143146 working_dir = v. to_string ( ) ;
144- } else if flag_val. starts_with ( "-run" ) || flag_val. starts_with ( "--run" ) || flag_val. starts_with ( "-r" ) {
147+ } else if arg. starts_with ( "-run" ) || arg. starts_with ( "--run" ) || arg. starts_with ( "-r" ) {
148+ let mut v = arg
149+ . replace ( "--run" , "" )
150+ . replace ( "-run" , "" )
151+ . replace ( "-r" , "" )
152+ . replace ( "\" " , "" )
153+ . replace ( "\' " , "" ) ;
154+ if v. starts_with ( "=" ) {
155+ v = v[ 1 ..v. len ( ) ] . to_string ( ) ;
156+ }
145157 tool_name = v;
146158 run_tool = true ;
147- } else if flag_val. starts_with ( "-toolhelp" ) || flag_val. starts_with ( "--toolhelp" ) {
159+ } else if arg. starts_with ( "-toolhelp" ) || arg. starts_with ( "--toolhelp" ) {
160+ let mut v = arg
161+ . replace ( "--toolhelp" , "" )
162+ . replace ( "-toolhelp" , "" )
163+ . replace ( "\" " , "" )
164+ . replace ( "\' " , "" ) ;
165+ if v. starts_with ( "=" ) {
166+ v = v[ 1 ..v. len ( ) ] . to_string ( ) ;
167+ }
148168 tool_name = v;
149169 tool_help = true ;
150- } else if flag_val. starts_with ( "-toolparameters" ) || flag_val. starts_with ( "--toolparameters" ) {
170+ } else if arg. starts_with ( "-toolparameters" ) || arg. starts_with ( "--toolparameters" ) {
171+ let mut v = arg
172+ . replace ( "--toolparameters" , "" )
173+ . replace ( "-toolparameters" , "" )
174+ . replace ( "\" " , "" )
175+ . replace ( "\' " , "" ) ;
176+ if v. starts_with ( "=" ) {
177+ v = v[ 1 ..v. len ( ) ] . to_string ( ) ;
178+ }
151179 tool_name = v;
152180 tool_parameters = true ;
153- } else if flag_val. starts_with ( "-toolbox" ) || flag_val. starts_with ( "--toolbox" ) {
181+ } else if arg. starts_with ( "-toolbox" ) || arg. starts_with ( "--toolbox" ) {
182+ let mut v = arg
183+ . replace ( "--toolbox" , "" )
184+ . replace ( "-toolhelp" , "" )
185+ . replace ( "\" " , "" )
186+ . replace ( "\' " , "" ) ;
187+ if v. starts_with ( "=" ) {
188+ v = v[ 1 ..v. len ( ) ] . to_string ( ) ;
189+ }
154190 tool_name = v;
155191 toolbox = true ;
156- } else if flag_val . starts_with ( "-listtools" )
157- || flag_val . starts_with ( "--listtools" )
158- || flag_val . starts_with ( "-list_tools" )
159- || flag_val . starts_with ( "--list_tools" )
192+ } else if arg . starts_with ( "-listtools" )
193+ || arg . starts_with ( "--listtools" )
194+ || arg . starts_with ( "-list_tools" )
195+ || arg . starts_with ( "--list_tools" )
160196 {
161197 list_tools = true ;
162- } else if flag_val. starts_with ( "-viewcode" ) || flag_val. starts_with ( "--viewcode" ) {
198+ } else if arg. starts_with ( "-viewcode" ) || arg. starts_with ( "--viewcode" ) {
199+ let mut v = arg
200+ . replace ( "--viewcode" , "" )
201+ . replace ( "-viewcode" , "" )
202+ . replace ( "\" " , "" )
203+ . replace ( "\' " , "" ) ;
204+ if v. starts_with ( "=" ) {
205+ v = v[ 1 ..v. len ( ) ] . to_string ( ) ;
206+ }
163207 tool_name = v;
164208 view_code = true ;
165- } else if flag_val . starts_with ( "-license" )
166- || flag_val . starts_with ( "-licence" )
167- || flag_val . starts_with ( "--license" )
168- || flag_val . starts_with ( "--licence" )
169- || flag_val . starts_with ( "-l" )
209+ } else if arg . starts_with ( "-license" )
210+ || arg . starts_with ( "-licence" )
211+ || arg . starts_with ( "--license" )
212+ || arg . starts_with ( "--licence" )
213+ || arg . starts_with ( "-l" )
170214 {
171215 license ( ) ;
172216 return Ok ( ( ) ) ;
173- } else if flag_val . starts_with ( "-version" ) || flag_val . starts_with ( "--version" ) {
217+ } else if arg . starts_with ( "-version" ) || arg . starts_with ( "--version" ) {
174218 version ( ) ;
175219 return Ok ( ( ) ) ;
176- } else if flag_val . trim ( ) == "-v" {
220+ } else if arg . trim ( ) == "-v" {
177221 verbose = true ;
178222 } else if arg. starts_with ( "-" ) {
179223 // it's an arg to be fed to the tool
0 commit comments