def getSynopsis(self):
""" Returns a string containing a description of these options and how to
pass them to the executed file.
"""
default = "%s%s" % (path.basename(sys.argv[0]),
(self.longOpt and " [options]") or '')
if self.parent is None:
default = "Usage: %s%s" % (path.basename(sys.argv[0]),
(self.longOpt and " [options]") or '')
else:
default = '%s' % ((self.longOpt and "[options]") or '')
synopsis = getattr(self, "synopsis", default)
synopsis = synopsis.rstrip()
if self.parent is not None:
synopsis = ' '.join((self.parent.getSynopsis(), self.parent.subCommand, synopsis))
return synopsis
评论列表
文章目录