aboutsummaryrefslogtreecommitdiff
path: root/services/manage
diff options
context:
space:
mode:
authorYuqian Yang <crupest@crupest.life>2025-02-23 16:40:32 +0800
committerYuqian Yang <crupest@crupest.life>2025-02-23 16:40:32 +0800
commit8d85090fc6a41aaa9366250982e41a5534bed283 (patch)
tree22051ae36ba29c25121257ef4ca5fe69fc107e87 /services/manage
parent687ae968e10e1738c105fc0538fc29ccb08bfbbf (diff)
downloadcrupest-8d85090fc6a41aaa9366250982e41a5534bed283.tar.gz
crupest-8d85090fc6a41aaa9366250982e41a5534bed283.tar.bz2
crupest-8d85090fc6a41aaa9366250982e41a5534bed283.zip
feat(python): move python codes.
Diffstat (limited to 'services/manage')
-rwxr-xr-xservices/manage18
1 files changed, 14 insertions, 4 deletions
diff --git a/services/manage b/services/manage
index 01f3145..4589475 100755
--- a/services/manage
+++ b/services/manage
@@ -2,13 +2,23 @@
set -e
-python3 --version > /dev/null 2>&1 || (
+python3 --version >/dev/null 2>&1 || (
echo Error: failed to run Python with python3 --version.
exit 1
)
script_dir="$(dirname "$0")"
-. "$script_dir/common.bash"
-export PYTHONPATH="$CRUPEST_PROJECT_DIR/$CRUPEST_SERVICES_DIR:$PYTHONPATH"
-python3 -m manager.service "$@"
+# shellcheck disable=SC2046
+export $(xargs <"${script_dir:?}/base-config")
+
+CRUPEST_PROJECT_DIR="$(realpath "$script_dir/..")"
+export CRUPEST_PROJECT_DIR
+
+export PYTHONPATH="$CRUPEST_PROJECT_DIR/python:$PYTHONPATH"
+
+if [[ "$#" != "0" ]] && [[ "$1" == "gen-tmpl" ]]; then
+ python3 -m cru.service template generate "${@:2}"
+else
+ python3 -m cru.service "$@"
+fi