more indentation fixes
This commit is contained in:
@@ -118,7 +118,6 @@ def main():
|
|||||||
parser.add_option("--skip-js", dest="skipjs", action="store_true", helptext="Don't output marker.js or regions.js")
|
parser.add_option("--skip-js", dest="skipjs", action="store_true", helptext="Don't output marker.js or regions.js")
|
||||||
parser.add_option("--no-signs", dest="nosigns", action="store_true", helptext="Don't output signs to markers.js")
|
parser.add_option("--no-signs", dest="nosigns", action="store_true", helptext="Don't output signs to markers.js")
|
||||||
parser.add_option("--display-config", dest="display_config", action="store_true", helptext="Display the configuration parameters, but don't render the map. Requires all required options to be specified", commandLineOnly=True)
|
parser.add_option("--display-config", dest="display_config", action="store_true", helptext="Display the configuration parameters, but don't render the map. Requires all required options to be specified", commandLineOnly=True)
|
||||||
parser.add_option("--advanced-help", dest="advanced_help", action="store_true", helptext="Display help - including advanced options", commandLineOnly=True)
|
|
||||||
#parser.add_option("--write-config", dest="write_config", action="store_true", helptext="Writes out a sample config file", commandLineOnly=True)
|
#parser.add_option("--write-config", dest="write_config", action="store_true", helptext="Writes out a sample config file", commandLineOnly=True)
|
||||||
|
|
||||||
options, args = parser.parse_args()
|
options, args = parser.parse_args()
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
@@ -23,7 +23,8 @@ class ConfigOptionParser(object):
|
|||||||
|
|
||||||
self.requiredArgs = []
|
self.requiredArgs = []
|
||||||
|
|
||||||
# add the *very* special config-file path option
|
# add the *very* special advanced help and config-file path options
|
||||||
|
self.add_option("--advanced-help", dest="advanced_help", action="store_true", helptext="Display help - including advanced options", commandLineOnly=True)
|
||||||
self.add_option("--settings", dest="config_file", helptext="Specifies a settings file to load, by name. This file's format is discussed in the README.", metavar="PATH", type="string", commandLineOnly=True)
|
self.add_option("--settings", dest="config_file", helptext="Specifies a settings file to load, by name. This file's format is discussed in the README.", metavar="PATH", type="string", commandLineOnly=True)
|
||||||
|
|
||||||
def display_config(self):
|
def display_config(self):
|
||||||
@@ -38,10 +39,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,16 +55,17 @@ 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()
|
||||||
|
|
||||||
|
|
||||||
def parse_args(self):
|
def parse_args(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user