README:补充一行命令安装方式;install.sh 下载静默化

This commit is contained in:
Mrpzx committed 2026-10-13 19:41:32 +08:00
1 parent 61b7a22df2
commit 671fe2f55a
2 files changed
+44 -5

No files matched your search

+43 -4
View File
@@ -8,16 +8,53 @@
## 一、安装与更新 ## 一、安装与更新
### 1. 安装为全局命令(推荐) ### 1. 一行命令安装(推荐,免装 Python)
自动识别系统与架构,拉取最新 Release 的独立可执行文件并装进 PATH:
```bash ```bash
curl -fsSL https://git.usetoks.com/Mrpzx/tripocli/raw/branch/main/install.sh | sh
```
安装到 `/usr/local/bin`(可写时)或 `~/.local/bin`。装完直接可用:
```bash
tripocli --version
tripocli --help
```
可选参数(环境变量):
```bash
# 指定版本
curl -fsSL .../install.sh | TRIPOCLI_VERSION=v2.0.0 sh
# 指定安装目录
curl -fsSL .../install.sh | TRIPOCLI_INSTALL_DIR=~/.local/bin sh
```
也可以手动下载:到 [Releases](https://git.usetoks.com/Mrpzx/tripocli/releases) 取对应平台的文件,`chmod +x` 后直接运行。
| 平台 | 文件 |
|---|---|
| Linux x86_64 | `tripocli-<版本>-linux-x86_64` |
| macOS(Apple Silicon) | `tripocli-<版本>-macos-arm64` |
> Windows 暂无独立可执行文件(PyInstaller 无法跨平台编译),请用下面的 pip 方式。
### 2. 用 pip 安装(需要 Python ≥ 3.8)
```bash
# 直接从 Gitea 仓库安装,无需先克隆
pip install "git+https://git.usetoks.com/Mrpzx/tripocli.git"
# 或在克隆后的项目目录里安装
cd <项目目录> cd <项目目录>
pip install . pip install .
pyenv rehash # 使用 pyenv 时执行一次以刷新命令路径 pyenv rehash # 使用 pyenv 时执行一次以刷新命令路径
tripocli --version tripocli --version
``` ```
### 2. 免安装直接运行 ### 3. 免安装直接运行
无需 `pip`,直接运行仓库内的入口脚本: 无需 `pip`,直接运行仓库内的入口脚本:
@@ -25,9 +62,11 @@ tripocli --version
<项目目录>/tripocli --version <项目目录>/tripocli --version
``` ```
### 3. 更新 ### 4. 更新
修改或拉取新源码后,一条命令重装全局 CLI: - 用安装脚本装的:**重跑一遍安装命令**即可(自动取最新版本);
- 用 pip 装的:`pip install -U "git+https://git.usetoks.com/Mrpzx/tripocli.git"`;
- 从源码跑且已 `pip install .` 的,可用内置命令从源码更新:
```bash ```bash
tripocli update # 从项目源码更新全局命令 tripocli update # 从项目源码更新全局命令
+1 -1
View File
@@ -53,7 +53,7 @@ info "==> 版本:$version"
tmp="$(mktemp "${TMPDIR:-/tmp}/tripocli.XXXXXX")" tmp="$(mktemp "${TMPDIR:-/tmp}/tripocli.XXXXXX")"
trap 'rm -f "$tmp"' EXIT INT TERM trap 'rm -f "$tmp"' EXIT INT TERM
info "==> 下载:$asset" info "==> 下载:$asset"
curl -fL --progress-bar -o "$tmp" "$url" || die "下载失败:$url" curl -fSL -sS -o "$tmp" "$url" || die "下载失败:$url"
chmod +x "$tmp" chmod +x "$tmp"
# 简单校验:确认是可执行文件而不是错误页面 # 简单校验:确认是可执行文件而不是错误页面
size=$(wc -c < "$tmp" | tr -d ' ') size=$(wc -c < "$tmp" | tr -d ' ')