跳转至

安装

环境要求

在安装 httptap 之前,请确保你具备:

  • Python 3.10-3.15(推荐 CPython)
  • pipuv 包管理器
  • macOS、Linux 或 Windows 操作系统

除标准网络能力外,无需任何系统依赖。

使用 uvx 运行

无需永久安装即可运行 httptap 的最快方式。uvx(随 uv 一同提供)会获取 httptap 并在一个临时的、隔离的环境中运行它:

uvx --from "httptap[completion]" httptap https://example.com

推荐用于快速试用

uvx 无需任何预先的安装步骤,且不会留下任何残留——非常适合一次性检查或试用 httptap。若需反复使用,请用下列方法之一进行安装。

通过 Homebrew 安装

brew install httptap
brew install httptap

适合 macOS/Linux 用户

Homebrew 安装是最简单的方法,并包含自动的 shell 自动补全设置。

从 PyPI 安装

uv pip install httptap

或作为全局工具安装:

uv tool install httptap
pip install httptap

用于隔离式的 CLI 工具安装:

pipx install httptap

通过容器运行

已签名的多架构(linux/amd64、linux/arm64)镜像会在每次发布时发布到 GitHub Container Registry:

docker run --rm ghcr.io/ozeranskii/httptap:latest https://example.com

使用 cosign(无密钥 Sigstore)校验镜像签名:

cosign verify ghcr.io/ozeranskii/httptap:latest \
  --certificate-identity-regexp 'https://github\.com/ozeranskii/httptap/\.github/workflows/release\.yml@.*' \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com

固定的主/次版本标签(例如 :0:0.6:0.6.0)也会一并发布。

从源码安装

克隆仓库

git clone https://github.com/ozeranskii/httptap.git
cd httptap

使用 uv 安装

uv sync

使用 pip 安装

python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
pip install -e .

验证安装

安装完成后,验证 httptap 是否正确安装:

httptap --version

你应该会看到类似如下的输出:

httptap X.Y.Z

升级

将 httptap 升级到最新版本:

brew upgrade httptap
uv pip install --upgrade httptap
pip install --upgrade httptap

卸载

从系统中移除 httptap:

brew uninstall httptap
uv pip uninstall httptap
pip uninstall httptap
pipx uninstall httptap

Shell 自动补全

httptap 支持 bash 和 zsh 的 shell 自动补全。

Homebrew 安装

如果你通过 Homebrew 安装了 httptap,补全会自动配置好。只需重启你的 shell:

# Restart your shell
exec $SHELL

Homebrew 会自动将补全脚本放置到:

  • Bash$(brew --prefix)/etc/bash_completion.d/
  • Zsh$(brew --prefix)/share/zsh/site-functions/

无需额外设置

Homebrew 会自动处理所有补全设置。只需重启你的 shell,即可开始使用 Tab 补全!

Python 包安装

如果你通过 pipuvpipx 安装了 httptap,则需要安装可选的 completion 附加项:

uv pip install "httptap[completion]"
pip install "httptap[completion]"
pipx install "httptap[completion]"

激活

  1. 激活你的虚拟环境(如果使用 venv):

    source .venv/bin/activate
    
  2. 为 bash/zsh 启用补全。可以一次性进行全局注册:

    activate-global-python-argcomplete
    

    或者,若只想为 httptap 启用补全,请将下面这行加入你的 shell 启动文件(例如 ~/.bashrc~/.zshrc):

    eval "$(register-python-argcomplete httptap)"
    
  3. 重启你的 shell。

用法

安装并激活后,你可以使用 Tab 来自动补全命令和选项:

# Complete command options
httptap --<TAB>

# Complete after typing partial option
httptap --fol<TAB>
# Completes to: httptap --follow

# Complete multiple options
httptap --follow --time<TAB>
# Completes to: httptap --follow --timeout

Note

全局激活脚本仅为 bash 和 zsh 提供参数补全。其他 shell 不在该脚本覆盖范围内,需单独配置。


下一步?