summaryrefslogtreecommitdiff
path: root/apply/status.py
blob: 514252bf8c53a94cbceff23af7bbf7561ba7c1e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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"