安装
环境要求
- Go 1.21 或更高版本(仅在通过
go install或源码安装时需要)。 - macOS、Linux、Windows 三平台。剪贴板回退使用
atotto/clipboard,三平台都支持。
go install(推荐)
bash
go install github.com/wuhan005/jkit/cmd/jkit@latest二进制会被装到 $GOPATH/bin(默认是 $HOME/go/bin)。确认这个目录在 PATH 里:
bash
export PATH="$HOME/go/bin:$PATH"源码编译
bash
git clone https://github.com/wuhan005/jkit.git
cd jkit
go install ./cmd/jkit验证安装
bash
> jkit --help
NAME:
jkit - JSON CLI Tool
USAGE:
jkit [global options] command [command options]
COMMANDS:
format, f Pretty-print JSON
cut, c Fold JSON to a maximum depth
get, g Extract a JSON sub-element by path
maker, m Build a JSON string array from line-separated input
help, h Shows a list of commands or help for one commandLinux 剪贴板支持
Linux 下剪贴板功能需要安装 xclip 或 xsel:
bash
# Debian / Ubuntu
sudo apt install xclip
# 或
sudo apt install xsel
# Arch
sudo pacman -S xclip如果两者都没装,管道 / 重定向输入仍然可用,只是没法回退到剪贴板。
卸载
bash
rm "$(go env GOPATH)/bin/jkit"