def cmd_help(self, *args):
'''-3|help|Show's help'''
alldata = []
lengths = []
for i in self.commandSort:
alldata.append(
self.commands[i].__doc__.split("|")[1:])
for i in alldata:
if len(i) > len(lengths):
for j in range(len(i)
- len(lengths)):
lengths.append(0)
j = 0
while j < len(i):
if len(i[j]) > lengths[j]:
lengths[j] = len(i[j])
j += 1
print ("-" * (lengths[0] + lengths[1] + 4))
for i in alldata:
print (("%-" + str(lengths[0]) + "s - %-" + str(
lengths[1]) + "s") % (i[0], i[1]))
if len(i) > 2:
for j in i[2:]: print (("%" + str(lengths[
0] + 9) + "s* %s") % (" ", j))
print
评论列表
文章目录