将命令移至main.py中

This commit is contained in:
zhbaor 2024-09-23 19:14:57 +08:00
parent d9f1aae27c
commit 32496af392
4 changed files with 19 additions and 10 deletions

15
main.py
View file

@ -22,6 +22,19 @@ def custom_event(name, data):
window.evaluate_js(js)
command_list = {
"ensurepip": "python\\python -m ensurepip --default-pip --no-warn-script-location",
"clone": "git\\bin\\git clone https://git-cf.zhaozuohong.vip/mower-ng/mower-ng.git --branch slow",
"fetch": "..\\git\\bin\\git fetch",
"switch_fast": "..\\git\\bin\\git switch -f fast",
"switch_slow": "..\\git\\bin\\git switch -f slow",
"reset_fast": "..\\git\\bin\\git reset --hard origin/fast",
"reset_slow": "..\\git\\bin\\git reset --hard origin/slow",
"webview": "start ..\\python\\pythonw webview_ui.py",
"manager": "start ..\\python\\pythonw manager.py",
}
class Api:
def get_branch(self):
return config["branch"]
@ -37,7 +50,7 @@ class Api:
def run(self, command, cwd=None):
with Popen(
command,
command_list[command],
stdout=PIPE,
stderr=STDOUT,
shell=True,