Skip to Content
S.EE Docs
开发者

CLI

S.EE 平台的命令行客户端

使用 S.EE CLI,可直接在终端中管理短网址、文本片段、文件、个人主页和二维码。

功能

  • 短网址:创建、更新和删除链接,支持自定义别名、域名、密码和过期时间;查看历史记录和访问统计
  • 文本片段:从标准输入或文件分享代码和笔记,支持语法高亮
  • 文件:通过路径或标准输入上传文件,支持私密文件,以及最大 5 GB 的断点续传上传
  • 个人主页和二维码:创建和管理个人主页与动态二维码
  • 账号:查看 API 用量,验证 API 密钥
  • JSON 输出:任何命令加上 --json 即可输出机器可读格式

安装

macOS

brew tap sdotee/homebrew-tap
brew install see

Debian / Ubuntu / RHEL(xTom 软件源)

xTom 在其 APT 和 DNF 软件源中提供了 CLI 的 amd64 和 arm64 安装包,之后可以通过 apt upgrade 或 dnf upgrade 更新。支持的系统:Debian 12 和 13,Ubuntu 22.04、24.04 和 26.04 LTS,以及 RHEL、Rocky Linux 和 AlmaLinux 9 和 10。

快速设置,自动为您的系统添加软件源:

curl -sL ba.sh/repo | sudo bash

然后安装 see 软件包:

# Debian / Ubuntu
sudo apt install see

# RHEL / Rocky / AlmaLinux
sudo dnf install see

也可以手动添加软件源:

# Debian / Ubuntu
sudo apt install -y ca-certificates curl gnupg
curl -fsSL https://repo.xtom.com/xtom.key | sudo bash -c 'gpg --dearmor > /usr/share/keyrings/xtom.gpg'
echo "deb [signed-by=/usr/share/keyrings/xtom.gpg] https://repo.xtom.com/deb stable main" | sudo tee /etc/apt/sources.list.d/xtom.list
sudo apt update
sudo apt install see

# RHEL / Rocky / AlmaLinux
sudo curl -o /etc/yum.repos.d/xtom.repo https://repo.xtom.com/rpm/xtom.repo
sudo dnf install see

在 Debian 上也可以运行 sudo extrepo enable xtom 添加软件源。更多方式请参阅 xTom 软件源说明。

Linux 安装包

每个 Release 都提供 amd64 和 arm64 的安装包。下载适合您系统的安装包后安装:

# Debian / Ubuntu
sudo dpkg -i see-cli_<version>_linux_<arch>.deb

# RHEL / Fedora
sudo rpm -i see-cli_<version>_linux_<arch>.rpm

# Alpine
sudo apk add --allow-untrusted see-cli_<version>_linux_<arch>.apk

# Arch Linux
sudo pacman -U see-cli_<version>_linux_<arch>.pkg.tar.zst

例如 see-cli_1.4.0_linux_amd64.deb。

Android(Termux)

从 v1.4.1 起,Release 中提供适用于 aarch64 的 Termux 安装包:

dpkg -i see-cli_<version>_android_arm64.termux.deb

Arch Linux(AUR)

yay -S see-cli
# 或安装预构建二进制版本
yay -S see-cli-bin

预构建二进制文件

Release 中还提供 macOS、Linux 和 FreeBSD 的压缩包(see_<OS>_<arch>.tar.gz),以及 Windows 的压缩包(see_Windows_<arch>.zip),支持 x86_64 和 arm64。从 v1.4.1 起还提供 see_Android_arm64.tar.gz。解压后把 see 放到 PATH 中即可。

从源码构建

需要 Go 1.26 或更高版本:

git clone https://github.com/sdotee/cli.git
cd cli
make build   # 生成 ./see

也可以使用 go install(v1.4.1 及以上)。Go 会按模块路径命名二进制文件,安装后的文件名是 cli,需要重命名为 see:

go install github.com/sdotee/cli@latest
mv "$(go env GOPATH)/bin/cli" "$(go env GOPATH)/bin/see"

配置

通过环境变量或参数设置 API 密钥。API 密钥可在 工具 > API 密钥 获取。

# 环境变量(推荐)
export SEE_API_KEY="your-api-key"

# 或通过参数使用
see --api-key "your-api-key" <command>

配置选项

选项环境变量说明
--api-keySEE_API_KEY您的 S.EE API 密钥(必填)
--base-urlSEE_BASE_URL自定义 API 基础 URL
--timeoutSEE_TIMEOUT请求超时时间
--json-输出 JSON

两种超时设置的格式不同:--timeout 使用时长格式,例如 30s 或 2m;SEE_TIMEOUT 使用整数秒,例如 30,其他格式的值会被忽略并使用默认超时时间。

see --timeout 30s domains
SEE_TIMEOUT=30 see domains

运行 see help <command> 可查看命令的全部参数。

命令

域名和标签

# 短网址可用域名
see domains

# 文本和文件可用域名
see text domains
see file domains

# 您的标签
see tags

短网址

# 创建短网址(输出短网址)
see shorturl create https://example.com

# 带选项创建
see shorturl create https://example.com \
  --domain s.ee \
  --slug example \
  --title "Example" \
  --password secret \
  --expire-at 1798761600

# 修改目标网址(必须提供 --target-url)
see shorturl update example --domain s.ee --target-url https://example.com/new --title "New Title"

# 删除
see shorturl delete example --domain s.ee

# 历史记录和访问统计
see shorturl history --page 1
see shorturl stats example --domain s.ee --period daily

see url 是 see shorturl 的别名。--domain 默认为 s.ee。--expire-at 使用以秒为单位的 Unix 时间戳。创建时还可以使用 --tag-ids 和 --expiration-redirect-url。统计周期可以是 daily、monthly 或 totally。

文本片段

文本命令从标准输入读取内容,或用 --file 从文件读取。

# 从标准输入创建
echo "Hello World" | see text create --title "greeting"

# 从文件创建
see text create --file ./snippet.txt --title "Code Snippet"

# 带选项创建
cat script.sh | see text create \
  --domain ba.sh \
  --slug demo \
  --title "Shell Script" \
  --type source_code \
  --password secret

# 更新内容和标题
see text update demo --domain ba.sh --title "Updated Title" --file ./script.sh

# 删除
see text delete demo --domain ba.sh

# 历史记录
see text history --page 1

--type 可以是 plain_text、source_code 或 markdown。每条文本都需要标题:create 未提供 --title 时使用 Untitled,update 必须提供 --title。see text update 会替换文本内容,所以同样需要 --file 或标准输入。

文件

# 上传一个或多个文件
see file upload ./image.png ./document.pdf

# 指定域名和自定义别名
see file upload ./document.pdf --domain fs.to --slug report

# 上传为私密文件
see file upload ./invoice.pdf --private

# 从标准输入上传(必须提供 --name)
cat image.png | see file upload --name image.png

# 历史记录(每页 30 个文件)
see file history --page 1

# 获取私密文件的临时下载链接(约一小时内有效)
see file download-url <file-id>

# 用上传后显示的删除密钥删除
see file delete <delete-key>

100 MB 以内的文件一次上传完成,更大的文件会分块断点续传,最大 5 GB。从标准输入上传时始终一次上传。

个人主页

see bio create "My Bio" \
  --description "About me" \
  --mastodon-url https://c.im/@s.ee \
  --link Blog=https://example.com

see bio update <id> --title "Updated Bio" --link Blog=https://example.com
see bio history --page 1
see bio delete <id>

--link title=url 可以重复使用。update 时传入的链接会替换现有的自定义链接。create 还支持 --domain、--slug 和 --rss-url。

二维码

see qrcode create https://example.com --title "Example"
see qrcode history --page 1
see qrcode delete <slug> --domain s.ee

--title 为必填。创建后会输出二维码的短网址,以及 PNG、SVG 和 PDF 图片地址。

账号

# API、内容、文件和存储用量
see usage

# 检查当前配置的 API 密钥,或其他密钥
see token check
see token check <api-key>

# 版本
see version

JSON 输出

任何命令加上 --json 即可输出机器可读格式:

see shorturl create https://example.com --json | jq -r '.short_url'

示例

创建短网址并复制(macOS)

see shorturl create https://example.com | pbcopy

上传截图并输出链接

see file upload ~/screenshot.png --json | jq -r '.url'

缩短文件中的每个网址

while read -r url; do
  see shorturl create "$url"
done < urls.txt

On this page