cli

clap for CLI argument parsing with derive macros

For CLI tools, clap is the de facto standard. Version 4+ supports derive macros, letting you define arguments as a struct with attributes. The library auto-generates help text, validates inputs, and supports subcommands. I annotate fields with #[arg(s

anyhow::Context for adding error context without custom types

When prototyping or writing applications (not libraries), anyhow is my go-to. It provides Result<T> as an alias for Result<T, anyhow::Error>, which can hold any error type. The .context() method attaches additional context to errors as the

std::process::Command for spawning external processes

std::process::Command runs external programs and captures their output. I use it for CLI tools that wrap other commands, build scripts, or integration tests. Methods like .arg(), .env(), and .current_dir() configure the process. .output() runs and wai

Django custom management command for data import

Management commands are perfect for scripts that need Django's ORM and settings. I create them in management/commands/ and extend BaseCommand. The add_arguments method defines CLI options using argparse. I use self.stdout.write with style helpers for

Laravel custom Artisan commands

Artisan commands automate repetitive tasks via the command line. I create command classes with php artisan make:command defining signatures and descriptions. The handle() method contains command logic. Arguments and options capture user input with typ

color-eyre for beautiful error reports with backtraces

color-eyre enhances eyre (an anyhow alternative) with colored, human-readable error messages and backtraces. It automatically captures panic backtraces and suggestion hints. I use it in CLI tools where error UX matters. The setup is minimal: color_eyr