-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxhs
More file actions
executable file
·43 lines (41 loc) · 1.32 KB
/
xhs
File metadata and controls
executable file
·43 lines (41 loc) · 1.32 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
43
#!/bin/bash
# 小红书工具包 - 统一启动脚本
# 获取脚本目录
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$SCRIPT_DIR"
# 如果没有参数,启动交互式界面
if [ $# -eq 0 ]; then
# 检查是否有uv命令
if command -v uv &> /dev/null; then
if [ ! -d ".venv" ]; then
echo "🔧 首次运行,正在安装依赖..."
uv sync
fi
exec uv run python xhs_toolkit_interactive.py
elif [ -f ".venv/bin/python" ]; then
exec .venv/bin/python xhs_toolkit_interactive.py
elif [ -f "venv/bin/python" ]; then
exec venv/bin/python xhs_toolkit_interactive.py
else
if command -v python3 &> /dev/null; then
exec python3 xhs_toolkit_interactive.py
else
exec python xhs_toolkit_interactive.py
fi
fi
else
# 如果有参数,执行传统命令
if command -v uv &> /dev/null && [ -d ".venv" ]; then
exec uv run python xhs_toolkit.py "$@"
elif [ -f ".venv/bin/python" ]; then
exec .venv/bin/python xhs_toolkit.py "$@"
elif [ -f "venv/bin/python" ]; then
exec venv/bin/python xhs_toolkit.py "$@"
else
if command -v python3 &> /dev/null; then
exec python3 xhs_toolkit.py "$@"
else
exec python xhs_toolkit.py "$@"
fi
fi
fi