From cc0024057431b59a1d81d86c0850540fa87115eb Mon Sep 17 00:00:00 2001 From: codeboss <2422523675@qq.com> Date: Mon, 29 Jul 2024 11:52:28 +0800 Subject: [PATCH] 'save-at:1722225148.8869774' --- manage/MileStone.py | 21 +++++++++++++++++++++ manage/NovelManage.py | 29 +++++++++++++++++++++++++++++ manage/__init__.py | 0 3 files changed, 50 insertions(+) create mode 100644 manage/MileStone.py create mode 100644 manage/NovelManage.py create mode 100644 manage/__init__.py diff --git a/manage/MileStone.py b/manage/MileStone.py new file mode 100644 index 0000000..eb5cec1 --- /dev/null +++ b/manage/MileStone.py @@ -0,0 +1,21 @@ +import sys +import shutil as cmd + + +base_store_path = r"E:\baseline_core\milestone.xast" +current_store_path = r"E:\storyline.xast" + + +def milestone_new(f_from: str, f_to: str) -> str: + return cmd.copy2(f_from, f_to) + + +if __name__ == "__main__": + print(sys.argv) + if len(sys.argv) <= 1: + exit(0) + + # milestone:new + if "".join(sys.argv[1:]) == "milestone:new": + milestone_new(current_store_path, base_store_path) + pass diff --git a/manage/NovelManage.py b/manage/NovelManage.py new file mode 100644 index 0000000..eff3fc9 --- /dev/null +++ b/manage/NovelManage.py @@ -0,0 +1,29 @@ +import sys, os +import subprocess as xsub +import time + + +def git_save(target_dir: str): + retls = xsub.run("git status", shell=True, capture_output=True) + print(retls.stdout) + outlist = str(retls.stdout).split(r'\n') + has_changed:bool = False + for o in outlist: + if o.startswith(r"\tmodified:"): + has_changed = True + break + elif o.startswith(r"\tnew file:"): + has_changed = True + break + + if has_changed: + xsub.run("git add .", shell=True) + xsub.run(f"git commit -m 'save-at:{time.time()}'") + + +if __name__ == "__main__": + print(sys.argv) + cmd_line = ":".join(sys.argv[1:]) + #wnss:-cmp + if cmd_line == "wnss:-cmp": + git_save(os.getcwd()) \ No newline at end of file diff --git a/manage/__init__.py b/manage/__init__.py new file mode 100644 index 0000000..e69de29