Browse Source

Add subcommand pretty listing

pull/8/head
Luke Murphy 5 years ago
parent
commit
0f3edc0970
No known key found for this signature in database GPG Key ID: 5E2EF5A63E3718CC
  1. 33
      bin/etherpump

33
bin/etherpump

@ -1,9 +1,26 @@
#!/usr/bin/env python3
import os
import sys
from pathlib import Path
from etherpump import __VERSION__
def subcommands():
"""List all sub-commands for the `--help` output."""
subcommands = []
all_files = os.listdir(Path().absolute() / 'etherpump' / 'commands')
modules = filter(lambda file: not file.startswith('__'), all_files)
for module in modules:
name = module.split('.py')[0]
subcommands.append(f' {name}')
return '\n'.join(subcommands)
usage = """
_
| |
@ -18,23 +35,15 @@ Usage:
where CMD could be:
pull
index
dumpcsv
gettext
gethtml
creatediffhtml
list
listauthors
revisionscount
showmeta
html5tidy
{}
For more information on each command try:
etherpump CMD --help
"""
""".format(
subcommands()
)
try:
cmd = sys.argv[1]

Loading…
Cancel
Save