diff --git a/main.py b/main.py index 07e0e1d..9889397 100644 --- a/main.py +++ b/main.py @@ -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.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, diff --git a/ui/src/pages/Init.vue b/ui/src/pages/Init.vue index a6aa830..f04bcfb 100644 --- a/ui/src/pages/Init.vue +++ b/ui/src/pages/Init.vue @@ -3,11 +3,11 @@ const steps = ref([ { title: '设置Git LFS', command: ['git\\bin\\git lfs install'] }, { title: '安装pip', - command: ['python\\python -m ensurepip --default-pip --no-warn-script-location'] + command: ['ensurepip'] }, { title: '下载代码', - command: ['git\\bin\\git clone https://git.zhaozuohong.vip/mower-ng/mower-ng.git --branch slow'] + command: ['clone'] } ]) provide('steps', steps) diff --git a/ui/src/pages/Launch.vue b/ui/src/pages/Launch.vue index d1919f1..aa01d19 100644 --- a/ui/src/pages/Launch.vue +++ b/ui/src/pages/Launch.vue @@ -1,10 +1,10 @@ diff --git a/ui/src/pages/Update.vue b/ui/src/pages/Update.vue index 4d60e5c..fefa31f 100644 --- a/ui/src/pages/Update.vue +++ b/ui/src/pages/Update.vue @@ -14,11 +14,7 @@ watch(branch, () => { const steps = computed(() => [ { title: '下载源码', - command: [ - '..\\git\\bin\\git fetch', - `..\\git\\bin\\git switch -f ${branch.value}`, - `..\\git\\bin\\git reset --hard origin/${branch.value}` - ], + command: ['fetch', `switch_${branch.value}`, `reset_${branch.value}`], cwd: 'mower-ng' }, {