diff options
-rw-r--r-- | python/refcat/cli.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/python/refcat/cli.py b/python/refcat/cli.py index ca1cab7..076c71f 100644 --- a/python/refcat/cli.py +++ b/python/refcat/cli.py @@ -86,9 +86,9 @@ def cat(*args): """ if len(args) == 0: raise ValueError("ls failed: task name required") - task = find_task(args[0]) + task_class = find_task_class(args[0]) try: - filename = task().output().path + filename = task_class().output().path if filename.endswith(".zst"): subprocess.run(["zstdcat", "-T0", filename]) elif filename.endswith(".gz"): @@ -107,8 +107,8 @@ def ls(*args): """ if len(args) == 0: raise ValueError("ls failed: task name required") - task = find_task(args[0]) - print(task().output().path) + task_class = find_task_class(args[0]) + print(task_class().output().path) def ll(*args): @@ -117,9 +117,9 @@ def ll(*args): """ if len(args) == 0: raise ValueError("ls failed: task name required") - task = find_task(args[0]) + task_class = find_task_class(args[0]) try: - filename = task().output().path + filename = task_class().output().path subprocess.run(["ls", "-lah", filename]) except FileNotFoundError: print("file not found: {}".format(filename), file=sys.stderr) @@ -133,8 +133,8 @@ def deps(*args): """ if len(args) == 0: raise ValueError("deps failed: task name required") - task = find_task(args[0]) - dump_deps(task()) + task_class = find_task_class(args[0]) + dump_deps(task_class()) def config(): @@ -180,16 +180,16 @@ complete -F _refcat_completion "refcat" print(snippet) -def find_task(name): +def find_task_class(name): """ Note: return task class, not instance. """ - task = globals().get(name) - if task is None: + task_class = globals().get(name) + if task_class is None: raise RuntimeError("no such task: {}".format(name)) - if not isinstance(task(), luigi.Task): + if not isinstance(task_class(), luigi.Task): raise RuntimeError("not a task: {}".format(name)) - return task + return task_class def main(): |