--- a/opster.py Sat Sep 11 10:39:15 2010 +0300
+++ b/opster.py Sun Sep 19 19:25:02 2010 +0300
@@ -160,9 +160,9 @@
for cmd, info in cmdtable.items():
if cmd.startswith('~'):
- continue # do not display hidden commands
+ continue # do not display hidden commands
if shortlist and not cmd.startswith('^'):
- continue # short help contains only marked commands
+ continue # short help contains only marked commands
cmd = cmd.lstrip('^~')
doc = info[0].__doc__ or '(no help text available)'
hlp[cmd] = doc.splitlines()[0].rstrip()
@@ -174,7 +174,7 @@
write('\ncommands:\n\n')
for cmd in hlplist:
doc = hlp[cmd]
- if False: # verbose?
+ if False: # verbose?
write(' %s:\n %s\n' % (cmd.replace('|', ', '), doc))
else:
write(' %-*s %s\n' % (maxlen, cmd.split('|', 1)[0],
@@ -280,7 +280,8 @@
shortlist, namelist, funlist = '', [], []
for o in options:
- short, name, default, comment = o[:4] # might have the fifth completer element
+ # might have the fifth completer element
+ short, name, default, comment = o[:4]
if short and len(short) != 1:
raise FOError('Short option should be only a single'
' character: %s' % short)
@@ -332,7 +333,6 @@
return state, args
-
# --------
# Subcommand system
# --------
@@ -531,13 +531,13 @@
"""
# Don't complete if user hasn't sourced bash_completion file.
- if not os.environ.has_key('OPSTER_AUTO_COMPLETE'):
+ if 'OPSTER_AUTO_COMPLETE' not in os.environ:
return
cwords = os.environ['COMP_WORDS'].split()[1:]
cword = int(os.environ['COMP_CWORD'])
try:
- current = cwords[cword-1]
+ current = cwords[cword - 1]
except IndexError:
current = ''
@@ -559,7 +559,7 @@
short, long, default, help = o[:4]
completer = o[4] if len(o) > 4 else None
short, long = '-%s' % short, '--%s' % long
- options += [short,long]
+ options += [short, long]
if cwords[idx] in (short, long) and completer:
args = middleware(completer)(current)