File tree Expand file tree Collapse file tree 1 file changed +6
-19
lines changed Expand file tree Collapse file tree 1 file changed +6
-19
lines changed Original file line number Diff line number Diff line change @@ -447,27 +447,14 @@ class OptionParser
447447  #  Parses a command-line argument into a flag and optional inline value.
448448  private  def  parse_arg_to_flag_and_value (arg  : String ) : {String , String ?}
449449    if  arg.starts_with?(" --"  )
450-       value_index =  arg.index('=' )
451-       if  value_index
452-         flag =  arg[0 ...value_index]
453-         value =  arg[value_index +  1 ..- 1 ]
454-       else 
455-         flag =  arg
456-         value =  nil 
450+       name, separator, value =  arg.partition(" ="  )
451+       if  separator ==  " =" 
452+         return  {name, value}
457453      end 
458-     elsif  arg.starts_with?('-' )
459-       if  arg.size >  2 
460-         flag =  arg[0 ..1]
461-         value =  arg[2 ..- 1 ]
462-       else 
463-         flag =  arg
464-         value =  nil 
465-       end 
466-     else 
467-       flag =  arg
468-       value =  nil 
454+     elsif  arg.starts_with?('-' ) &&  arg.size >  2 
455+       return  {arg[0 ..1], arg[2 ..]}
469456    end 
470-     {flag, value }
457+     {arg,  nil }
471458  end 
472459
473460  #  Processes a single flag/subcommand. Matches original behaviour exactly.
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments