Metadata-Version: 2.4
Name: rmsafe
Version: 1.3.0
Summary: Modern rm replacement with trash, undo, and Btrfs support
Project-URL: Homepage, https://github.com/leftrk/rmsafe
Project-URL: Repository, https://github.com/leftrk/rmsafe.git
Project-URL: Issues, https://github.com/leftrk/rmsafe/issues
Author-email: leftrk <guanhua@example.com>
License-Expression: GPL-2.0-only
License-File: COPYING
Keywords: btrfs,cli,rm,trash,undo
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Utilities
Requires-Python: >=3.11
Requires-Dist: rich>=10.0.0
Requires-Dist: typer>=0.9.0
Description-Content-Type: text/markdown

# rmsafe

A modern `rm` replacement that moves files to trash instead of deleting them.

[English](README.md) | [中文](README_CN.md)

## Install

```bash
# uv (recommended)
uv tool install rmsafe

# pipx
pipx install rmsafe

# Homebrew
brew install leftrk/tap/rmsafe

# pip
pip install rmsafe
```

## Usage

Replace `rm` in your shell:

```bash
alias rm='rmsafe trash'
```

### Commands

| Command | Description |
|---------|-------------|
| `rmsafe trash <files>` | Move files to trash |
| `rmsafe restore <pattern>` | Restore trashed files |
| `rmsafe list [pattern]` | List trashed files |
| `rmsafe undo [n]` | Undo recent deletions |
| `rmsafe undo --list` | Show undo history |
| `rmsafe empty [days]` | Empty trash |
| `rmsafe status` | Trash statistics |

### Examples

```bash
rmsafe trash file.txt              # Move to trash
rmsafe trash *.log --dry-run       # Preview
rmsafe restore file.txt            # Restore
rmsafe undo                        # Undo last deletion
rmsafe undo --list                 # Show history table
rmsafe empty 7                     # Delete files older than 7 days
rmsafe status                      # Panel with stats
```

## Features

- **Rich output**: Tables, panels, icons, progress bars
- **Undo history**: Track and undo recent deletions
- **Smart UX**: Progress bar for batch operations, transient cleanup
- **Cross-platform**: macOS (`~/.Trash`), Linux (FreeDesktop Trash spec)
- **Btrfs optimized**: Zero-copy reflink clone on Linux
- **JSONC config**: Comments and trailing commas supported

## Config

`~/.config/rmsafe/config.jsonc`:

```jsonc
{
  "trash": { "location": null, "auto_clean_days": 30 },
  "behavior": { "confirm_large_files": "10MB", "undo_history_limit": 100 },
  "output": { "color": "auto", "icons": true }
}
```

## vs trash-cli

| Feature | rmsafe | trash-cli |
|---------|--------|-----------|
| Output | Rich tables/icons | Plain text |
| Undo history | Built-in | Limited |
| Progress bar | Yes (≥4 files) | No |
| Config format | JSONC | INI |
| Btrfs clone | Yes | No |

## Development

```bash
git clone https://github.com/leftrk/rmsafe.git
cd rmsafe
uv sync
uv run pytest
uv run ruff check .
```

CI runs on Ubuntu + macOS × Python 3.11–3.13.

## License

GPL-2.0