def do_opt(self, *args, **kwargs):
        """ Get and set options """
        args = list(args)
        if not args:
            largest = 0
            keys = [key for key in self.conf if not key.startswith("_")]
            for key in keys:
                largest = max(largest, len(key))
            for key in keys:
                print("%s : %s" % (key.rjust(largest), self.conf[key]))
            return
        option = args.pop(0)
        if not args and not kwargs:
            method = getattr(self, "getopt_" + option, None)
            if method is None:
                self.getopt_default(option)
            else:
                method()
        else:
            method = getattr(self, "opt_" + option, None)
            if method is None:
                print("Unrecognized option %r" % option)
            else:
                method(*args, **kwargs)
                self.save_config()
def do_opt ( self , * args , ** kwargs ) : args = list ( args ) if not args : largest = 0 keys = [ key for key in self . conf if not key . startswith ( "_" ) ] for key in keys : largest = max ( largest , len ( key ) ) for key in keys : print ( "%s : %s" % ( key . rjust ( largest ) , self . conf [ key ] ) ) return option = args . pop ( 0 ) if not args and not kwargs : method = getattr ( self , "getopt_" + option , None ) if method is None : self . getopt_default ( option ) else : method ( ) else : method = getattr ( self , "opt_" + option , None ) if method is None : print ( "Unrecognized option %r" % option ) else : method ( * args , ** kwargs ) self . save_config ( )
Get and set options