From 7e93444f28a6790ab66fbdd8cc7eed9ca8970d48 Mon Sep 17 00:00:00 2001 From: Julian T Date: Sun, 25 Apr 2021 20:12:25 +0200 Subject: Add kind of working delete command --- apply/status_cmd.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 apply/status_cmd.py (limited to 'apply/status_cmd.py') diff --git a/apply/status_cmd.py b/apply/status_cmd.py new file mode 100644 index 0000000..514252b --- /dev/null +++ b/apply/status_cmd.py @@ -0,0 +1,24 @@ +import argparse +from .state import StateFile, FileState +from pathlib import Path +from tabulate import tabulate + + +def cmd_args(_: argparse.ArgumentParser): + pass + + +def cmd_func(args, config): + state = StateFile(args.apply_dir) + rows = [] + for link in state.links: + st = FileState.check_location(Path(link)) + rows.append((link, st.check_string(Path.cwd()))) + + print(tabulate(rows, headers=["Link", "Status"]), "\n") + + rows = state.dirs.items() + print(tabulate(rows, headers=["Directory", "Owned by"])) + + +cmd_help = "Check status on owned links" -- cgit v1.2.3