diff options
-rw-r--r-- | python/refcat/cli.py | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/python/refcat/cli.py b/python/refcat/cli.py index 042bb3d..ac308b7 100644 --- a/python/refcat/cli.py +++ b/python/refcat/cli.py @@ -88,9 +88,10 @@ def cat(*args): """ if len(args) == 0: raise ValueError("ls failed: task name required") - task_class = find_task_class(args[0]) + parser = CmdlineParser(sys.argv[2:]) + output = parser.get_task_obj().output() try: - filename = task_class().output().path + filename = output.path if filename.endswith(".zst"): subprocess.run(["zstdcat", "-T0", filename]) elif filename.endswith(".gz"): @@ -100,7 +101,7 @@ def cat(*args): except FileNotFoundError: print("file not found: {}".format(filename), file=sys.stderr) except AttributeError: - print("{} is most likely not a task object".format(name), file=sys.stderr) + print("most likely not a task object", file=sys.stderr) def ls(*args): @@ -111,7 +112,6 @@ def ls(*args): raise ValueError("ls failed: task name required") parser = CmdlineParser(sys.argv[2:]) output = parser.get_task_obj().output() - # task_class = find_task_class(args[0]) print(output.path) @@ -121,14 +121,15 @@ def ll(*args): """ if len(args) == 0: raise ValueError("ls failed: task name required") - task_class = find_task_class(args[0]) + parser = CmdlineParser(sys.argv[2:]) + output = parser.get_task_obj().output() try: - filename = task_class().output().path + filename = output.path subprocess.run(["ls", "-lah", filename]) except FileNotFoundError: print("file not found: {}".format(filename), file=sys.stderr) except AttributeError: - print("{} is most likely not a task object".format(name), file=sys.stderr) + print("most likely not a task object", file=sys.stderr) def deps(*args): @@ -137,8 +138,11 @@ def deps(*args): """ if len(args) == 0: raise ValueError("deps failed: task name required") - task_class = find_task_class(args[0]) - dump_deps(task_class()) + # task_class = find_task_class(args[0]) + # dump_deps(task_class()) + parser = CmdlineParser(sys.argv[2:]) + obj = parser.get_task_obj() + dump_deps(obj) def config(): |