Skip to main content

🫰 Thanos - Eliminate half of all files with a snap. Perfectly balanced, as all things should be.

Project description

🫰 Thanos

"Perfectly balanced, as all things should be."

A glove

A Python CLI tool that randomly eliminates half of the files in a directory with a snap. Inspired by Marvel's Thanos and his infamous snap.

Test Python application Python 3.9+ Coverage Status License: MIT

⚠️ Warning

This tool permanently deletes files! Use --dry-run first to preview what would be deleted. Deleted files cannot be recovered. Use at your own risk!

✨ Features

  • 🎲 Random Selection: Eliminates exactly half of all files randomly
  • 🔒 Safety First: Requires confirmation before deletion
  • 👁️ Dry Run Mode: Preview what would be deleted without actually deleting
  • 📁 Recursive Support: Optionally include files in subdirectories

📦 Installation

Using uv (recommended)

uv add thanos-cli
uv pip install thanos-cli   # <- if you don't have pyproject.toml

Using pip

pip install thanos-cli

🚀 Quick Start

# Always start with a dry run to see what would be deleted
thanos --dry-run

# Snap the current directory (requires confirmation)
thanos

# Snap a specific directory
thanos /path/to/directory

# Include subdirectories recursively
thanos --recursive

# Dry run on a specific directory with subdirectories
thanos /path/to/directory --recursive --dry-run

# Dry run with deterministic output
thanos --dry-run --seed 42

📖 Usage

thanos [OPTIONS] [DIRECTORY]

Arguments

  • DIRECTORY - Target directory to snap (default: current directory)

Options

  • -r, --recursive - Include files in subdirectories recursively
  • -d, --dry-run - Preview what would be deleted without actually deleting
  • -s, --seed <INTEGER> - Use a random seed for reproducible file selection
  • --help - Show help message and exit

Examples

# See what would happen in current directory
thanos --dry-run

# Snap current directory
thanos

# Snap specific directory
thanos /tmp/test-files

# Snap with subdirectories
thanos ~/old-projects --recursive

For detailed usage instructions, see USAGE.md.

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

🤔 FAQ

Q: Can I recover deleted files? A: No, files are permanently deleted. Always use --dry-run first!

Q: How are files selected? A: Files are selected completely randomly using Python's random.sample().

Q: Does it delete directories? A: No, only files are affected. Empty directories may remain.

Q: What if I have an odd number of files? A: If you have 11 files, 5 will be deleted (11 // 2 = 5) and 6 will remain.

🙏 Acknowledgments

  • Built with Typer for the beautiful CLI
  • Tested with pytest
  • Inspired by the Marvel Cinematic Universe

Remember: With great power comes great responsibility. Use Thanos wisely! 🫰

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

thanos_cli-0.1.1.tar.gz (59.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

thanos_cli-0.1.1-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file thanos_cli-0.1.1.tar.gz.

File metadata

  • Download URL: thanos_cli-0.1.1.tar.gz
  • Upload date:
  • Size: 59.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.17

File hashes

Hashes for thanos_cli-0.1.1.tar.gz
Algorithm Hash digest
SHA256 efd0637eff9c4c31ca98c8790fe88b25398c81030cd2ec8fc852634a8ac28009
MD5 3c94b6ac89d531dd008b2fcaa6206804
BLAKE2b-256 d803a951c2e614a93d92031fb72ce6894fae57a904db78d746db489194dafcde

See more details on using hashes here.

File details

Details for the file thanos_cli-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: thanos_cli-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.17

File hashes

Hashes for thanos_cli-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 91216e1c0bb543d824cef1af4ac447be3551e8c4b0f9e25c2efa442cac2ea8f5
MD5 5c513ab6333860cadb3fc5c9a281957a
BLAKE2b-256 fe2f80183050319fbb8443f34bcd38b85a7f691f7ac52da2dd3f2503f18cdb91

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page