fix help display + probably fix issue #60

This commit is contained in:
n1nj4sec 2015-12-30 18:18:36 +01:00
parent 8a8510c856
commit 29d50178d9
2 changed files with 14 additions and 4 deletions

View File

@ -300,7 +300,7 @@ class PupyCmd(cmd.Cmd):
try:
doc=getattr(self, 'do_' + arg).__doc__
if doc:
self.stdout.write("%s\n"%str(doc))
self.stdout.write("%s\n"%str(doc).strip())
return
except AttributeError:
pass
@ -327,7 +327,7 @@ class PupyCmd(cmd.Cmd):
cmds_doc.append(cmd)
del help[cmd]
elif getattr(self, name).__doc__:
cmds_doc.append((cmd, getattr(self, name).__doc__))
cmds_doc.append((cmd, getattr(self, name).__doc__.strip()))
else:
cmds_doc.append((cmd, ""))
for name in [x for x in self.aliases.iterkeys()]:
@ -335,7 +335,9 @@ class PupyCmd(cmd.Cmd):
self.stdout.write("%s\n"%str(self.doc_header))
for command,doc in cmds_doc:
self.stdout.write("- {:<10} {}\n".format(command, color(doc,'grey')))
if doc is None:
doc=""
self.stdout.write("- {:<10} {}\n".format(command, color(doc.strip(),'grey')))
@staticmethod
def format_log(msg):

View File

@ -134,7 +134,15 @@ class PupyJob(object):
# raise RuntimeError("job %s has already been started !"%str(self))
for m in self.pupymodules:
margs=m.arg_parser.parse_args(args)
comp, comp_exp= m.is_compatible()
res = m.is_compatible()
if type(res) is tuple:
comp, comp_exp=res
elif res is None:
comp=True
comp_exp=""
else:
comp=res
comp_exp="reason not precised"
if not comp:
m.error("Compatibility error : %s"%comp_exp)
continue