def add_option ( self , * args , * * kwargs ) : if self . parseTool == 'argparse' : if args and args [ 0 ] == '' : # no short option args = args [ 1 : ] return self . parser . add_argument ( * args , * * kwargs ) else : return self . parser . add_option ( * args , * * kwargs )
python argparse is value the default or did user specify
Add optparse or argparse option depending on CmdHelper initialization .
def add_option(self, *args, **kwargs):
        """Add optparse or argparse option depending on CmdHelper initialization."""
        if self.parseTool == 'argparse':
            if args and args[0] == '':   # no short option
                args = args[1:]
            return self.parser.add_argument(*args, **kwargs)
        else:
            return self.parser.add_option(*args, **kwargs)