cli-power-tools
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseUtility Pro
全能CLI工具集
Overview
概述
Masters the command-line environment by turning raw text and unstructured data into actionable insights. Combines Rust-powered search tools (ripgrep, fd, bat), structured data shells (Nushell), JSON manipulation (jq/yq), and modern HTTP clients (xh) for high-performance CLI workflows.
Core philosophy: Replace legacy text-parsing pipelines (grep/awk/sed chains) with purpose-built tools that understand structure. ripgrep understands gitignore rules, fd understands file types, jq understands JSON, and Nushell understands tables.
When to use: Codebase-wide search and analysis, multi-file refactoring, JSON/YAML transformation pipelines, API debugging, directory navigation, log parsing, disk usage auditing, dependency tracing.
When NOT to use: GUI-based tasks, complex application logic (write a script instead), tasks requiring interactive prompts.
精通命令行环境,可将原始文本和非结构化数据转化为可执行的洞察信息。结合Rust驱动的搜索工具(ripgrep、fd、bat)、结构化数据shell(Nushell)、JSON处理工具(jq/yq)以及现代HTTP客户端(xh),打造高性能CLI工作流。
核心理念: 用理解数据结构的专用工具替代传统文本解析流水线(grep/awk/sed链)。ripgrep理解gitignore规则,fd理解文件类型,jq理解JSON,Nushell理解表格。
适用场景: 全代码库搜索与分析、多文件重构、JSON/YAML转换流水线、API调试、目录导航、日志解析、磁盘使用审计、依赖追踪。
不适用场景: 基于GUI的任务、复杂应用逻辑(建议编写脚本替代)、需要交互式提示的任务。
Quick Reference
快速参考
| Pattern | Tool / Command | Key Points |
|---|---|---|
| Text search | | 10-100x faster than grep, respects |
| File search | | Fast alternative to |
| Syntax-highlighted read | | Cat with syntax highlighting and git integration |
| Directory jump | | Remembers frequently visited directories |
| Fuzzy search | | Interactive selection for files and history |
| Tree view | | Metadata-rich ls replacement with tree support |
| JSON query | | Full functional programming for JSON |
| YAML query | | jq-like syntax for YAML files |
| HTTP request | | Colorized, user-friendly HTTP client |
| Multi-file refactor | | Find files then execute transforms |
| Structured shell | | Nushell tables instead of text parsing |
| Log parsing | | Combine ripgrep JSON output with jq filters |
| File preview with search | | Browse files with syntax-highlighted preview |
| Find recently changed | | Find files modified within a time window |
| Export count by file | | Count matches per file, sorted by frequency |
| JSON format conversion | | Convert between YAML, JSON, CSV, and other formats |
| Advanced regex search | | PCRE2 for lookahead/lookbehind patterns |
| Git-aware file listing | | Show file metadata with inline git status |
| 用途 | 工具/命令 | 核心要点 |
|---|---|---|
| 文本搜索 | | 比grep快10-100倍,遵循 |
| 文件搜索 | | 替代 |
| 语法高亮查看文件 | | 支持语法高亮和Git集成的Cat替代工具 |
| 目录跳转 | | 记忆常用访问目录 |
| 模糊搜索 | | 文件与历史记录的交互式选择工具 |
| 树形视图展示 | | 支持树形展示的元数据丰富型ls替代工具 |
| JSON查询 | | 面向JSON的完整函数式编程能力 |
| YAML查询 | | 类jq语法的YAML处理工具 |
| HTTP请求 | | 带颜色输出、用户友好的HTTP客户端 |
| 多文件重构 | | 查找文件后执行批量转换操作 |
| 结构化shell | | 用Nushell表格替代文本解析 |
| 日志解析 | | 将ripgrep的JSON输出与jq过滤器结合使用 |
| 带搜索的文件预览 | | 浏览文件时展示语法高亮预览 |
| 查找最近修改的文件 | | 查找指定时间窗口内修改的文件 |
| 按文件导出匹配计数 | | 统计每个文件的匹配次数并按频率排序 |
| JSON格式转换 | | 在YAML、JSON、CSV等格式间相互转换 |
| 高级正则搜索 | | 支持前瞻/后顾模式的PCRE2正则引擎 |
| 感知Git的文件列表 | | 展示文件元数据及内嵌Git状态 |
Tool Overview
工具概览
| Category | Modern Tool | Replaces | Key Advantage |
|---|---|---|---|
| Text search | ripgrep ( | grep, ag, git grep | Speed, |
| File search | fd | find | Smart defaults, regex, parallelism |
| File viewer | bat | cat, less | Syntax highlighting, git diff markers |
| Directory jump | zoxide ( | cd, autojump | Frecency-based ranking, fzf fallback |
| Fuzzy finder | fzf | manual piping | Universal selector for any list |
| File listing | eza | ls, tree | Tree view, git status, icons |
| JSON processing | jq | awk, python oneliners | Typed, functional JSON transforms |
| YAML processing | yq | sed on YAML | jq-compatible syntax for YAML |
| HTTP client | xh | curl, httpie | HTTPie syntax, Rust speed, single binary |
| Structured shell | Nushell | bash + awk/sed | Typed tables, native format conversion |
| 分类 | 现代工具 | 替代工具 | 核心优势 |
|---|---|---|---|
| 文本搜索 | ripgrep ( | grep, ag, git grep | 速度快、支持 |
| 文件搜索 | fd | find | 智能默认配置、支持正则、并行处理 |
| 文件查看器 | bat | cat, less | 语法高亮、Git差异标记 |
| 目录跳转工具 | zoxide ( | cd, autojump | 基于访问频率排序、支持fzf降级使用 |
| 模糊查找器 | fzf | 手动管道操作 | 适用于任意列表的通用选择器 |
| 文件列表工具 | eza | ls, tree | 树形视图、Git状态显示、图标支持 |
| JSON处理工具 | jq | awk, Python单行脚本 | 类型化、函数式JSON转换 |
| YAML处理工具 | yq | 处理YAML的sed工具 | 兼容jq语法的YAML处理工具 |
| HTTP客户端 | xh | curl, httpie | HTTPie语法、Rust级速度、单二进制文件 |
| 结构化shell | Nushell | bash + awk/sed | 类型化表格、原生格式转换 |
Common Mistakes
常见误区
| Mistake | Correct Pattern |
|---|---|
Using | Use |
Piping | Use |
Writing complex | Use Nushell or |
Running | Always add a verification or dry-run step before destructive operations |
| Using capturing groups in regex when not needed | Prefer non-capturing groups |
Searching | Use |
Forgetting | ripgrep JSON emits begin, match, context, end, and summary message types |
Using | Use |
Parsing text output between tools with | Use Nushell pipelines that preserve structured data through every stage |
Anchoring regex with | Anchor with |
| 错误做法 | 正确方式 |
|---|---|
使用 | 使用 |
将 | 使用 |
为结构化数据编写复杂 | 使用Nushell或 |
在脚本中直接运行 | 执行破坏性操作前务必添加验证或预演步骤 |
| 不必要时在正则中使用捕获组 | 优先使用非捕获组 |
搜索 | 使用默认跳过这些目录的 |
使用 | ripgrep的JSON输出包含begin、match、context、end和summary等多种消息类型 |
使用带冗长参数语法的 | 使用 |
使用 | 使用Nushell管道,在整个流程中保留结构化数据 |
在正则开头使用 | 尽可能使用 |
Installation
安装方法
All tools are available via common package managers. Most are single statically linked binaries.
| Tool | macOS (Homebrew) | Linux (apt/cargo) |
|---|---|---|
| ripgrep | | |
| fd | | |
| bat | | |
| zoxide | | |
| fzf | | |
| eza | | |
| jq | | |
| yq | | |
| xh | | |
| Nushell | | |
Shell integration (add to shell config after installing):
| Tool | Shell Integration Required |
|---|---|
| zoxide | |
| fzf | Source keybinding and completion scripts from fzf install |
所有工具均可通过常用包管理器获取,多数为单静态链接二进制文件。
| 工具 | macOS(Homebrew) | Linux(apt/cargo) |
|---|---|---|
| ripgrep | | |
| fd | | |
| bat | | |
| zoxide | | |
| fzf | | |
| eza | | |
| jq | | |
| yq | | |
| xh | | |
| Nushell | | |
Shell集成(安装后添加到Shell配置文件):
| 工具 | 所需Shell集成配置 |
|---|---|
| zoxide | |
| fzf | 从fzf安装目录导入快捷键和补全脚本 |
Delegation
任务委派建议
- Large-scale codebase search and analysis: Use agent to run ripgrep queries, trace dependencies, and map code patterns
Explore - Multi-file refactoring workflows: Use agent to coordinate fd, sed, and verification steps across an entire project
Task - Pipeline architecture for data transformation: Use agent to design structured pipelines combining jq, Nushell, and API tools
Plan
- 大规模代码库搜索与分析:使用agent运行ripgrep查询、追踪依赖并映射代码模式
Explore - 多文件重构工作流:使用agent协调fd、sed和验证步骤,完成全项目范围的操作
Task - 数据转换流水线架构设计:使用agent设计结合jq、Nushell和API工具的结构化流水线
Plan
References
参考资料
- Modern Unix Toolbox -- ripgrep, fd, bat, zoxide, fzf, eza, terminal setup
- Advanced Regex and jq -- named captures, lookahead/lookbehind, jq filters, integrated pipelines
- Nushell Structured Data -- table paradigm, API interaction, scripting, Unix interop
- Modern Unix Toolbox -- ripgrep、fd、bat、zoxide、fzf、eza、终端配置
- Advanced Regex and jq -- 命名捕获组、前瞻/后顾模式、jq过滤器、集成流水线
- Nushell Structured Data -- 表格范式、API交互、脚本编写、Unix互操作性