From 0b2f47aabd8fbf1ca78534e3fe02ce6b491309a7 Mon Sep 17 00:00:00 2001 From: James Downie Date: Mon, 30 Jun 2025 09:06:16 +1000 Subject: [PATCH 1/2] Lazy commit on yancy. --- jdownie/repo/repo | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/jdownie/repo/repo b/jdownie/repo/repo index 2285c19..2d31b67 100755 --- a/jdownie/repo/repo +++ b/jdownie/repo/repo @@ -9,6 +9,15 @@ import json import time from pathlib import Path +def ind(): + print('\u2B06\uFE0F\u0031\uFE0F\u20E3') # ⬆️1️⃣ + print('\u2B07\uFE0F\u0032\uFE0F\u20E3') # ⬇️2️⃣ + for i in range(1, 6): + digit = str(i) + keycap = digit + '\uFE0F\u20E3' + print(f"\u2B06\uFE0F{keycap} Up {i}") + print(f"\u2B07\uFE0F{keycap} Down {i}") + def rm(p): if os.path.exists(p): os.remove(p) From ba4084c2264e9cb32f1e2794e844f2d3c33191b1 Mon Sep 17 00:00:00 2001 From: James Downie Date: Mon, 30 Jun 2025 16:34:47 +1000 Subject: [PATCH 2/2] Lazy commit on . --- jdownie/repo/repo | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/jdownie/repo/repo b/jdownie/repo/repo index 2d31b67..611ce5f 100755 --- a/jdownie/repo/repo +++ b/jdownie/repo/repo @@ -129,6 +129,50 @@ if __name__ == "__main__": if sys.argv[1] == "list": for k in cfg.keys(): print(k) + elif sys.argv[1] == "test": + dat = dict() + cache_file = filepath("test") + if is_file_recent(cache_file): + with open(cache_file, "rt") as fin: + dat = json.load(fin) + else: + for k in r: + path = os.path.expanduser( cfg[k]["path"] ) + if os.path.exists( path ): + cmd = "git -C \"{0}\" status --porcelain=2 --branch".format( path ) + props = dict() + props["key"] = k + lines = execute_command(cmd).split("\n") + n = 0 + for line in lines: + m = re.match(r"# branch\.(\S+)\s+(.+)$", line) + if m: + prop = m.group(1) + rest = m.group(2) + if prop == "ab": + print("ding") + m2 = re.match(r"[+](\d+)\n[-](\d+)", rest) + p2 = "?" + if m2: + p2 = dict() + p2["push"] = int(m2.group(1)) + p2["pull"] = int(m2.group(2)) + props[prop] = p2 + props[prop] = p2 + elif prop == "oid": + props["commit"] = rest + else: + props[prop] = rest + else: + n = n + 1 + props["n"] = n + print(props) + dat[k] = n + with open(cache_file, "wt") as fout: + json.dump(dat, fout, indent = 2) + for k in dat: + status = "-" if dat[k] == 0 else dat[k] + print("{0} {1}".format(str(status).rjust(3), k)) elif sys.argv[1] == "status": dat = dict() cache_file = filepath("status")