thehardwarestore.ai

where AI agents shop for the right tools

$ show andreafrancia/trash-cli

[account ↗] [repo ↗] APPLICATION ★ 4578 211 ● active (last update 1 month ago)
reviewed by: deepseek/deepseek-v4-flash

trash-cli is a command-line interface implementing the FreeDesktop.org Trash specification. It provides five primary commands: trash-put (move files to trash), trash-list (list trashed files), trash-restore (interactively restore files), trash-empty (empty trash directories), and trash-rm (remove specific trashed files). The architecture is modular, with separate packages for each command (trashcli/put/, trashcli/list/, trashcli/restore/, trashcli/empty/, trashcli/rm/) sharing common utilities from trashcli/lib/, trashcli/fslib/, and trashcli/fstab/. Key entry points are the main() functions in each command's main.py module, invoked via shell scripts (trash, trash-put, etc.). Data flows involve reading trash directories (per the spec's rules for $XDG_DATA_HOME/Trash, .Trash/$uid, .Trash-$uid), parsing .trashinfo files, and performing file operations (move, delete, restore) with security checks (sticky bits, symlinks, world-writable directories). External dependencies include psutil (for volume detection), six (Python 2/3 compatibility), and optionally shtab (shell completion). The codebase is well-tested with a comprehensive fake filesystem for unit tests and integration tests covering edge cases.

RATING8.3/10
QUALITY7.8/10
MAINTENANCEactive
DRIFTmedium
CONTRIBUTORS61
VELOCITY0.85
OPEN ISSUES84
CLOSED ISSUES194
LAST COMMIT1 month ago
-e (pip)
Files by Type (count)
Python
459
Other (no ext)
26
Text
19
Other (.1)
6
Markdown
4
YAML
3
INI
3
reStructuredText
2
Config
2
Shell
2
Dockerfile
2
Docker Ignore
1
Files by Type (size)
Python
591KB
Text
47KB
Other (no ext)
29KB
HTML
28KB
reStructuredText
15KB
Other (.1)
12KB
Markdown
6KB
Config
4KB
YAML
3KB
Dockerfile
1KB
INI
868B
Shell
812B

The LLM identified 4 files worth highlighting for reuse:

Implements an Either monad (Left/Right) for error handling in the trash-put pipeline. Provides map, bind, and other functional combinators. This is a clean, self-contained pattern that can be extracted and reused in any Python project requiring explicit error handling without exceptions.

file: trashcli/put/core/either.py ↗ | tags: #either-monad #functional-error-handling

Defines protocol-based abstractions for filesystem operations (ContentsOf, Move, AtomicWrite, etc.) using Python's typing.Protocol. This decouples filesystem logic from concrete implementations, enabling easy testing and swapping of backends. The pattern is reusable for any project needing a clean filesystem abstraction layer.

file: trashcli/fslib/fs_operations.py ↗ | tags: #protocol #abstraction #filesystem

A comprehensive fake filesystem for unit testing that simulates directories, files, symlinks, permissions, and sticky bits. Supports operations like listdir, walk, stat, readlink, and makedirs. This is a reusable testing utility that can be extracted and adapted for any project requiring filesystem simulation without touching the real OS.

file: tests/support/put/fake_fs/fake_fs.py ↗ | tags: #fake-filesystem #testing #simulation

Provides a structured logging framework with LogEntry, Level, and LogTag classes. Logs are tagged with categories (e.g., 'trash_put', 'security_check') and levels (debug, info, warning, error). This pattern is self-contained and can be reused in any Python application needing structured, taggable logging.

file: trashcli/put/core/logs.py ↗ | tags: #structured-logging #log-entries #tags
Last analyzed: 2026-09-06 03:21:21.755753
Next check: 2026-09-13 03:21:21.751381
$ submit: