@@ -167,7 +167,6 @@ def __init__(
167167        indent_increment = 2 ,
168168        max_help_position = 24 ,
169169        width = None ,
170-         prefix_chars = '-' ,
171170        color = False ,
172171    ):
173172        # default setting for width 
@@ -177,7 +176,6 @@ def __init__(
177176            width  -=  2 
178177
179178        self ._set_color (color )
180-         self ._prefix_chars  =  prefix_chars 
181179        self ._prog  =  prog 
182180        self ._indent_increment  =  indent_increment 
183181        self ._max_help_position  =  min (max_help_position ,
@@ -417,14 +415,7 @@ def _format_actions_usage(self, actions, groups):
417415        return  ' ' .join (self ._get_actions_usage_parts (actions , groups ))
418416
419417    def  _is_long_option (self , string ):
420-         return  len (string ) >=  2  and  string [1 ] in  self ._prefix_chars 
421- 
422-     def  _is_short_option (self , string ):
423-         return  (
424-             not  self ._is_long_option (string )
425-             and  len (string ) >=  1 
426-             and  string [0 ] in  self ._prefix_chars 
427-         )
418+         return  len (string ) >  2 
428419
429420    def  _get_actions_usage_parts (self , actions , groups ):
430421        # find group indices and identify actions in groups 
@@ -473,25 +464,22 @@ def _get_actions_usage_parts(self, actions, groups):
473464            # produce the first way to invoke the option in brackets 
474465            else :
475466                option_string  =  action .option_strings [0 ]
467+                 if  self ._is_long_option (option_string ):
468+                     option_color  =  t .summary_long_option 
469+                 else :
470+                     option_color  =  t .summary_short_option 
476471
477472                # if the Optional doesn't take a value, format is: 
478473                #    -s or --long 
479474                if  action .nargs  ==  0 :
480475                    part  =  action .format_usage ()
481-                     if  self ._is_long_option (part ):
482-                         part  =  f"{ t .summary_long_option } { part } { t .reset }  " 
483-                     elif  self ._is_short_option (part ):
484-                         part  =  f"{ t .summary_short_option } { part } { t .reset }  " 
476+                     part  =  f"{ option_color } { part } { t .reset }  " 
485477
486478                # if the Optional takes a value, format is: 
487479                #    -s ARGS or --long ARGS 
488480                else :
489481                    default  =  self ._get_default_metavar_for_optional (action )
490482                    args_string  =  self ._format_args (action , default )
491-                     if  self ._is_long_option (option_string ):
492-                         option_color  =  t .summary_long_option 
493-                     elif  self ._is_short_option (option_string ):
494-                         option_color  =  t .summary_short_option 
495483                    part  =  (
496484                        f"{ option_color } { option_string }   " 
497485                        f"{ t .summary_label } { args_string } { t .reset }  " 
@@ -608,10 +596,8 @@ def color_option_strings(strings):
608596                for  s  in  strings :
609597                    if  self ._is_long_option (s ):
610598                        parts .append (f"{ t .long_option } { s } { t .reset }  " )
611-                     elif  self ._is_short_option (s ):
612-                         parts .append (f"{ t .short_option } { s } { t .reset }  " )
613599                    else :
614-                         parts .append (s )
600+                         parts .append (f" { t . short_option } { s } { t . reset } "  )
615601                return  parts 
616602
617603            # if the Optional doesn't take a value, format is: 
@@ -2726,7 +2712,6 @@ def format_help(self):
27262712
27272713    def  _get_formatter (self ):
27282714        formatter  =  self .formatter_class (prog = self .prog )
2729-         formatter ._prefix_chars  =  self .prefix_chars 
27302715        formatter ._set_color (self .color )
27312716        return  formatter 
27322717
0 commit comments