summaryrefslogtreecommitdiff
path: root/optparser.py
diff options
context:
space:
mode:
authorJulien Jehannet <julien.jehannet@logilab.fr>2010-11-17 15:33:48 +0100
committerJulien Jehannet <julien.jehannet@logilab.fr>2010-11-17 15:33:48 +0100
commitc18dab780a4a6faa6aac3e9449d1450c1e0df012 (patch)
treea706ded0b023f45da3301c9be48c175c3b0d1b2b /optparser.py
parent9b6e46b21a3c5838b827388380f9dc4561c6b065 (diff)
downloadlogilab-common-c18dab780a4a6faa6aac3e9449d1450c1e0df012.tar.gz
[optparser] fix tab indentation
Diffstat (limited to 'optparser.py')
-rw-r--r--optparser.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/optparser.py b/optparser.py
index e6c4bb0..1469eb6 100644
--- a/optparser.py
+++ b/optparser.py
@@ -46,11 +46,11 @@ class OptionParser(optparse.OptionParser):
self.min_args, self.max_args = 0, 1
def add_command(self, name, mod_or_funcs, help=''):
- """name of the command
- name of module or tuple of functions (run, add_options)
- """
+ """name of the command, name of module or tuple of functions
+ (run, add_options)
+ """
assert isinstance(mod_or_funcs, str) or isinstance(mod_or_funcs, tuple), \
- "mod_or_funcs has to be a module name or a tuple of functions"
+ "mod_or_funcs has to be a module name or a tuple of functions"
self._commands[name] = (mod_or_funcs, help)
def print_main_help(self):
@@ -64,7 +64,7 @@ class OptionParser(optparse.OptionParser):
self.print_main_help()
sys.exit(1)
cmd = args[0]
- args = args[1:]
+ args = args[1:]
if cmd not in self._commands:
if cmd in ('-h', '--help'):
self.print_main_help()
@@ -79,8 +79,8 @@ class OptionParser(optparse.OptionParser):
self.description = help
if isinstance(mod_or_f, str):
exec 'from %s import run, add_options' % mod_or_f
- else:
- run, add_options = mod_or_f
+ else:
+ run, add_options = mod_or_f
add_options(self)
(options, args) = self.parse_args(args)
if not (self.min_args <= len(args) <= self.max_args):