mirror of
https://github.com/Ed1s0nZ/CyberStrikeAI.git
synced 2026-03-31 08:19:54 +02:00
Add files via upload
This commit is contained in:
@@ -1,8 +1,33 @@
|
||||
name: "execute-python-script"
|
||||
command: "python3"
|
||||
args: ["-c"]
|
||||
command: "/bin/bash"
|
||||
args:
|
||||
- "-c"
|
||||
- |
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_CONTENT="$1"
|
||||
ENV_NAME="${2:-default}"
|
||||
ADDITIONAL_ARGS="${3:-}"
|
||||
|
||||
BASE_DIR="${HOME}/.cyberstrike/venvs"
|
||||
ENV_DIR="${BASE_DIR}/${ENV_NAME}"
|
||||
|
||||
mkdir -p "$BASE_DIR"
|
||||
if [ ! -d "$ENV_DIR" ]; then
|
||||
python3 -m venv "$ENV_DIR"
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC1090
|
||||
source "$ENV_DIR/bin/activate"
|
||||
|
||||
if [ -n "$ADDITIONAL_ARGS" ]; then
|
||||
python3 $ADDITIONAL_ARGS -c "$SCRIPT_CONTENT"
|
||||
else
|
||||
python3 -c "$SCRIPT_CONTENT"
|
||||
fi
|
||||
- "_"
|
||||
enabled: true
|
||||
short_description: "执行Python脚本工具"
|
||||
short_description: "在指定虚拟环境中编写并执行Python脚本"
|
||||
description: |
|
||||
在虚拟环境中执行Python脚本。
|
||||
|
||||
@@ -29,6 +54,13 @@ parameters:
|
||||
required: true
|
||||
position: 0
|
||||
format: "positional"
|
||||
- name: "env_name"
|
||||
type: "string"
|
||||
description: "虚拟环境名称(默认default)"
|
||||
required: false
|
||||
default: "default"
|
||||
position: 1
|
||||
format: "positional"
|
||||
- name: "additional_args"
|
||||
type: "string"
|
||||
description: |
|
||||
@@ -43,3 +75,4 @@ parameters:
|
||||
- 此参数会直接追加到命令末尾
|
||||
required: false
|
||||
format: "positional"
|
||||
default: ""
|
||||
|
||||
Reference in New Issue
Block a user