YousefMohiey/tidy

GitHub: YousefMohiey/tidy

tidy 是一个基于文件实际内容类型进行智能分类整理的跨平台命令行工具,解决手动归档杂乱文件的痛点。

Stars: 2 | Forks: 0

tidy banner
[![Go](https://img.shields.io/badge/Go-1.22+-00ADD8?style=flat-square&logo=go)](https://go.dev) [![License](https://img.shields.io/badge/License-MIT-blue?style=flat-square)](LICENSE) [![Platform](https://img.shields.io/badge/Platform-Linux%20%7C%20Windows%20%7C%20macOS-lightgrey?style=flat-square)](#installation) [![Release](https://img.shields.io/github/v/release/YousefMohiey/tidy?style=flat-square)](https://github.com/YousefMohiey/tidy/releases) [![Go Report Card](https://goreportcard.com/badge/github.com/YousefMohiey/tidy?style=flat-square)](https://goreportcard.com/report/github.com/YousefMohiey/tidy) [![Downloads](https://img.shields.io/github/downloads/YousefMohiey/tidy/total?style=flat-square)](https://github.com/YousefMohiey/tidy/releases) **tidy** 是一个跨平台的文件整理工具,它根据文件的实际内容类型对文件进行分类——而不仅仅是依靠扩展名。 它具有交互式 TUI 仪表板、重复文件检测、实时 watch 模式以及完全的撤销支持。 [功能](#features) • [安装说明](#installation) • [快速开始](#quick-start) • [使用说明](#usage) • [配置](#configuration) • [架构](#architecture) • [构建](#building)
## 功能 | | | |---|---| | **🧠 感知内容的分类** | 读取文件的 magic bytes,而不仅仅是扩展名——一个重命名为 `.png` 的 `.jpg` 文件依然会被归类到图片中 | | **🖥️ 交互式 TUI 仪表板** | 在一个界面内完成整理、预览、去重、撤销和监控。支持完整的键盘导航 | | **🔍 预览模式** | 在实际移动任何文件之前,准确查看将要发生的变化——零风险 | | **↩️ 完全撤销** | 通过原子级防崩溃保存进行日志记录。可以撤销任何批量操作 | | **📜 撤销历史** | 浏览并撤销过去的操作,而不仅仅是最近的一次 | | **♻️ 重复文件检测** | 采用 SHA256 哈希算法以及经过速度优化的持久化缓存 | | **✅ 重复文件处理器** | 选择要保留或删除的副本,并生成已释放空间的报告 | | **👁️ Watch 模式** | 使用 fsnotify 实时自动整理新文件 | | **🌳 树状预览** | 在整理之前可视化文件的分类情况 | | **📊 进度报告** | 在整理和去重操作过程中提供实时计数 | | **📁 11 种分类** | 图片、文档、视频、音频、归档、代码、字体、可执行文件、磁盘映像、电子书、3D 模型 | | **📄 300 多种文件类型** | 从 `.jpg` 到 `.heic`,从 `.stl` 到 `.epub`——覆盖范围广泛 | | **💻 跨平台** | 支持 Linux、Windows、macOS——单一静态二进制文件,无任何依赖 | | **🏷️ 智能重命名** | 遇到命名冲突时,执行 `photo.jpg` → `photo_1.jpg` | | **⚙️ YAML 配置** | 通过简单的配置文件自定义规则和分类 | | **📌 Windows 右键菜单** | 右键点击任何文件夹 → 使用 tidy 整理 | | **🎨 ANSI 颜色** | 在包括 Windows CMD 在内的所有终端上支持全彩显示 | | **📂 文件夹浏览器** | 可视化导航或直接输入/粘贴路径(按 `g` 键) | ## 安装说明 ### Linux | 安装包 | 命令 | |---|---| | **Debian / Ubuntu (.deb)** | `wget https://github.com/YousefMohiey/tidy/releases/latest/download/tidy-1.2.0-amd64.deb && sudo dpkg -i tidy-1.2.0-amd64.deb` | | **Fedora / RHEL (.rpm)** | `wget https://github.com/YousefMohiey/tidy/releases/latest/download/tidy-1.2.0-1.x86_64.rpm && sudo rpm -i tidy-1.2.0-1.x86_64.rpm` | | **便携二进制文件** | `wget https://github.com/YousefMohiey/tidy/releases/latest/download/tidy-linux-amd64 -O tidy && chmod +x tidy && sudo mv tidy /usr/local/bin/tidy` | ### macOS ``` # Intel Mac curl -L https://github.com/YousefMohiey/tidy/releases/latest/download/tidy-macos-intel -o tidy chmod +x tidy && sudo mv tidy /usr/local/bin/ # Apple Silicon curl -L https://github.com/YousefMohiey/tidy/releases/latest/download/tidy-macos-arm64 -o tidy chmod +x tidy && sudo mv tidy /usr/local/bin/ ``` ### Windows 从 [Releases 页面](https://github.com/YousefMohiey/tidy/releases) 下载 **`tidy-Setup-x.x.x.exe`**。 - 安装至 `%LOCALAPPDATA%\Programs\tidy` - 自动添加到 `PATH` - 创建开始菜单和桌面快捷方式 - **无需管理员权限**——仅限于用户级别 ### 从源码构建 ``` git clone https://github.com/YousefMohiey/tidy.git cd tidy go build -o tidy ./cmd/tidy/ sudo mv tidy /usr/local/bin/ ``` ## 快速开始 ``` # 启动交互式 dashboard tidy # 或者直接从 CLI 整理目录 tidy organize ~/Downloads # 查看会发生什么,而无需实际移动任何文件 tidy organize --dry-run ~/Downloads ``` 不带参数运行 `tidy` 会打开 **TUI 仪表板**——这是你进行所有操作的中心枢纽。 ## 使用说明 ### 交互式仪表板 ``` tidy ``` **键盘快捷键:** | 按键 | 操作 | |---|---| | `e` | 浏览并选择目录 | | `o` | 整理文件 | | `p` | 预览(试运行) | | `d` | 扫描重复文件 | | `u` | 撤销上一步操作(需确认) | | `w` | 切换 watch 模式 | | `g` | 直接输入/粘贴路径 | | `s` | 选择当前目录 | | `← →` | 在路径输入框中移动光标 | | `Backspace` | 返回上一级目录 | | `1-4` | 切换标签页 | | `j/k` 或 `↑/↓` | 导航 / 滚动 | | `q` | 退出 | ### CLI 命令 ## 配置 tidy 使用 YAML 配置文件来设定自定义规则和分类。 默认位置:`~/.config/tidy/config.yaml` ``` rules: - name: Images extensions: [jpg, png, gif, webp, heic] magic_bytes: [image/jpeg, image/png] destination: Images patterns: [] - name: Custom extensions: [custom, special] magic_bytes: [] destination: Custom patterns: ["*.backup"] ``` ## 架构 ``` tidy/ ├── cmd/tidy/ # CLI entry point + Windows color support ├── internal/ │ ├── config/ # YAML config loading + path validation │ ├── rules/ # 3-phase matching engine │ ├── detector/ # MIME detection via magic bytes │ ├── organizer/ # File moves + atomic journal/undo │ ├── watcher/ # fsnotify watcher (async organize) │ ├── dedup/ # SHA256 dedup + persistent cache │ ├── paths/ # Platform-specific data directories │ ├── notify/ # Desktop notifications │ └── tui/ # 9 Bubble Tea TUI modules ├── installer/ # NSIS, RPM, DEB packaging ├── build.sh # Cross-platform build script └── config.yaml # Default rules ``` ## 构建 ``` ./build.sh ``` 生成所有平台的二进制文件和安装包: - Linux: `tidy-linux-amd64`, `.deb`, `.rpm` - Windows: `tidy-Setup-x.x.x.exe`, `tidy-windows-amd64.exe` - macOS: `tidy-macos-intel`, `tidy-macos-arm64` ## 许可证 [MIT](LICENSE) — 可免费使用、修改和分发。
标签:EVTX分析, Go, Ruby工具, TUI, 去重工具, 文件整理, 文件管理, 日志审计