From e74e24b0825104ba48b29a7622e1c3115111f979 Mon Sep 17 00:00:00 2001 From: Martin Czygan Date: Tue, 8 Jun 2021 21:17:06 +0200 Subject: cli: docs --- python/refcat/cli.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/python/refcat/cli.py b/python/refcat/cli.py index 5d62918..7e3804c 100644 --- a/python/refcat/cli.py +++ b/python/refcat/cli.py @@ -71,7 +71,7 @@ def effective_task_names(): def tasks(): """ - Print task name. + Print task names. """ for name in effective_task_names(): print(name) @@ -79,7 +79,7 @@ def tasks(): def files(): """ - Print task name and file. + Print task names and output file. """ for name in effective_task_names(): klass = Register.get_task_cls(name) @@ -89,9 +89,9 @@ def files(): print("{:40s}".format(name)) -def cat(*args): +def cat(): """ - Inspect file. + File contents to stdout. """ if len(sys.argv) < 2: raise ValueError("task name required") @@ -218,9 +218,11 @@ def main(): if len(sys.argv) >= 2 and sys.argv[1] in sub_commands: try: + # A hack to call the function within this file matching the + # subcommand name. func = globals()[sys.argv[1]] if callable(func): - func(*sys.argv[2:]) + func() else: print("not implemented: {}".format(sys.argv[1])) except KeyError: -- cgit v1.2.3