0

Fix tabs/spaces mixup in 8c87fa6bb5

This commit is contained in:
Thomas Lake
2011-08-15 17:16:48 +01:00
parent 8c87fa6bb5
commit 0c523461fa
2 changed files with 8 additions and 8 deletions

View File

@@ -145,7 +145,7 @@ def main():
if options.advanced_help: if options.advanced_help:
parser.advanced_help() parser.advanced_help()
sys.exit(0) sys.exit(0)
if len(args) < 1: if len(args) < 1:
logging.error("You need to give me your world number or directory") logging.error("You need to give me your world number or directory")

View File

@@ -12,7 +12,7 @@ class ConfigOptionParser(object):
self.cmdParser = optparse.OptionParser(usage=kwargs.get("usage","")) self.cmdParser = optparse.OptionParser(usage=kwargs.get("usage",""))
self.configFile = kwargs.get("config","settings.py") self.configFile = kwargs.get("config","settings.py")
self.configVars = [] self.configVars = []
self.advancedHelp = [] self.advancedHelp = []
# these are arguments not understood by OptionParser, so they must be removed # these are arguments not understood by OptionParser, so they must be removed
# in add_option before being passed to the OptionParser # in add_option before being passed to the OptionParser
@@ -38,10 +38,10 @@ class ConfigOptionParser(object):
self.configVars.append(kwargs.copy()) self.configVars.append(kwargs.copy())
if kwargs.get("advanced"): if kwargs.get("advanced"):
kwargs['help'] = optparse.SUPPRESS_HELP kwargs['help'] = optparse.SUPPRESS_HELP
self.advancedHelp.append((args, kwargs.copy())) self.advancedHelp.append((args, kwargs.copy()))
else: else:
kwargs["help"]=kwargs["helptext"] kwargs["help"]=kwargs["helptext"]
for arg in self.customArgs: for arg in self.customArgs:
if arg in kwargs.keys(): del kwargs[arg] if arg in kwargs.keys(): del kwargs[arg]
@@ -54,15 +54,15 @@ class ConfigOptionParser(object):
self.cmdParser.print_help() self.cmdParser.print_help()
def advanced_help(self): def advanced_help(self):
self.cmdParser.set_conflict_handler('resolve') # Allows us to overwrite the previous definitions self.cmdParser.set_conflict_handler('resolve') # Allows us to overwrite the previous definitions
for opt in self.advancedHelp: for opt in self.advancedHelp:
opt[1]['help']="[!]" + opt[1]['helptext'] opt[1]['help']="[!]" + opt[1]['helptext']
for arg in self.customArgs: for arg in self.customArgs:
if arg in opt[1].keys(): del opt[1][arg] if arg in opt[1].keys(): del opt[1][arg]
if opt[1].get("type", None): if opt[1].get("type", None):
opt[1]['type'] = 'string' # we'll do our own converting later opt[1]['type'] = 'string' # we'll do our own converting later
self.cmdParser.add_option(*opt[0], **opt[1]) self.cmdParser.add_option(*opt[0], **opt[1])
self.cmdParser.epilog = "Advanced options indicated by [!]. These options should not normally be required, and may have caveats regarding their use. See README file for more details" self.cmdParser.epilog = "Advanced options indicated by [!]. These options should not normally be required, and may have caveats regarding their use. See README file for more details"
self.print_help() self.print_help()