switched the new test output in to replace the old status output
This commit is contained in:
parent
02fc9cc8bf
commit
2f3e08f58c
@ -152,9 +152,9 @@ if __name__ == "__main__":
|
|||||||
if sys.argv[1] == "list":
|
if sys.argv[1] == "list":
|
||||||
for k in cfg.keys():
|
for k in cfg.keys():
|
||||||
print(k)
|
print(k)
|
||||||
elif sys.argv[1] == "test":
|
elif sys.argv[1] == "status":
|
||||||
dat = dict()
|
dat = dict()
|
||||||
cache_file = filepath("test")
|
cache_file = filepath("status")
|
||||||
if is_file_recent(cache_file):
|
if is_file_recent(cache_file):
|
||||||
with open(cache_file, "rt") as fin:
|
with open(cache_file, "rt") as fin:
|
||||||
dat = json.load(fin)
|
dat = json.load(fin)
|
||||||
@ -199,24 +199,6 @@ if __name__ == "__main__":
|
|||||||
flags = indicators(dat[k], "flags")
|
flags = indicators(dat[k], "flags")
|
||||||
print(f" {tl} {k.ljust(ml + 1)} {flags}")
|
print(f" {tl} {k.ljust(ml + 1)} {flags}")
|
||||||
# print(json.dumps(dat, indent = 2))
|
# print(json.dumps(dat, indent = 2))
|
||||||
elif sys.argv[1] == "status":
|
|
||||||
dat = dict()
|
|
||||||
cache_file = filepath("status")
|
|
||||||
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".format( path )
|
|
||||||
output = execute_command(cmd).split("\n")
|
|
||||||
dat[k] = 0 if len(output[0]) == 0 else len(output)
|
|
||||||
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] in list( [ "sync", "lc", "lcs", "pull", "push", "fetch" ] ):
|
elif sys.argv[1] in list( [ "sync", "lc", "lcs", "pull", "push", "fetch" ] ):
|
||||||
thread_count = 10
|
thread_count = 10
|
||||||
with concurrent.futures.ThreadPoolExecutor(max_workers=thread_count) as executor:
|
with concurrent.futures.ThreadPoolExecutor(max_workers=thread_count) as executor:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user