-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·42 lines (31 loc) · 1 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·42 lines (31 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
# PopClip 插件打包脚本
# 将当前目录的插件打包到 target 目录
set -e
# 获取脚本所在目录
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$SCRIPT_DIR"
# 从 Config.json 读取插件名称
PLUGIN_NAME=$(grep -o '"name"[[:space:]]*:[[:space:]]*"[^"]*"' Config.json | head -1 | sed 's/.*: *"\([^"]*\)"/\1/' | tr ' ' '_')
if [ -z "$PLUGIN_NAME" ]; then
echo "错误: 无法从 Config.json 读取插件名称"
exit 1
fi
# 目标目录
TARGET_DIR="$SCRIPT_DIR/target"
EXTENSION_NAME="${PLUGIN_NAME}.popclipext"
EXTENSION_PATH="$TARGET_DIR/$EXTENSION_NAME"
# 创建 target 目录
mkdir -p "$TARGET_DIR"
# 如果已存在同名插件,先删除
if [ -d "$EXTENSION_PATH" ]; then
rm -rf "$EXTENSION_PATH"
fi
# 创建插件目录
mkdir -p "$EXTENSION_PATH"
# 复制必要文件
cp Config.json "$EXTENSION_PATH/"
cp translate.js "$EXTENSION_PATH/"
echo "✓ 插件已打包到: $EXTENSION_PATH"
echo ""
echo "安装方法: 双击 $EXTENSION_NAME 文件夹即可安装到 PopClip"