Design and Build a Full-Featured Command-Line Interface (CLI) Tool
Create a polished CLI tool with subcommands, config support, colored output, progress indicators, and proper testing.
๐ The Prompt
You are a senior developer experienced in building polished, user-friendly command-line tools. Design and implement a complete CLI tool with the following specifications:
**Tool Overview:**
- Tool name: [TOOL_NAME]
- Purpose: [TOOL_PURPOSE, e.g., manage local dev environments, batch-rename files, interact with a REST API, process log files]
- Programming language: [LANGUAGE, e.g., Python, Rust, Go, Node.js]
- Target users: [TARGET_USERS, e.g., developers, sysadmins, data engineers]
**Core Commands & Features:**
1. Implement the following subcommands:
- [COMMAND_1]: [DESCRIPTION_OF_COMMAND_1]
- [COMMAND_2]: [DESCRIPTION_OF_COMMAND_2]
- [COMMAND_3]: [DESCRIPTION_OF_COMMAND_3]
2. Each command must support relevant flags and options with sensible defaults.
3. Include a global `--verbose` / `-v` flag for debug output and a `--quiet` / `-q` flag for minimal output.
4. Add a `--config` flag to specify a configuration file path (support YAML or JSON config).
**UX & Polish Requirements:**
5. **Help System**: Auto-generate help text for all commands and flags. Include usage examples in the help output.
6. **Input Validation**: Validate all arguments and provide clear, actionable error messages when input is invalid.
7. **Output Formatting**: Support multiple output formats (e.g., table, JSON, plain text) via a `--format` flag. Use colored output for terminal display (with automatic detection for non-TTY environments).
8. **Progress Feedback**: Show progress bars or spinners for long-running operations.
9. **Exit Codes**: Use meaningful exit codes (0 for success, 1 for general error, 2 for invalid usage).
**Code & Distribution:**
10. Structure the codebase with clean separation: entry point, command handlers, utilities, and configuration.
11. Include unit tests for core logic with at least [MIN_TEST_COUNT] test cases.
12. Provide a README with installation instructions, usage examples, and configuration reference.
13. Include a Makefile or build script for easy compilation/installation.
Deliver the complete source code, project structure overview, and the README file.
๐ก Tips for Better Results
Fill in all placeholder commands with specific actions relevant to your use case โ the more detail you provide, the more functional the generated code will be.
Choose a language with strong CLI library support (e.g., Click/Typer for Python, Cobra for Go, clap for Rust) and mention it explicitly for better results.
Ask for a follow-up prompt to add features like shell autocompletion, man page generation, or package distribution (pip, brew, etc.).
๐ฏ Use Cases
Developers and engineers who want to build internal tooling, automate repetitive tasks, or create open-source CLI utilities with a professional, user-friendly interface.
๐ Related Prompts
๐ป Coding
beginner
Explain Code Like Im a Beginner
Get any code explained in plain English with line-by-line breakdowns, analogies, and learning suggestions.
๐ป Coding
beginner
Debug My Code and Explain the Fix
Get your code debugged with clear explanations of what went wrong and why, plus the corrected version.
๐ป Coding
intermediate
Write Unit Tests for My Code
Generate thorough unit tests covering edge cases, error handling, and both positive and negative scenarios.
๐ป Coding
intermediate
Convert Code Between Languages
Convert code between any programming languages while maintaining idiomatic patterns and best practices.
๐ป Coding
intermediate
Write a REST API Endpoint
Generate production-ready REST API endpoints with validation, error handling, and documentation.
๐ป Coding
advanced
Create a GitHub Actions CI/CD Workflow for Automated Testing and Deployment
Generate a complete GitHub Actions CI/CD workflow with build, test, deploy, and notification jobs for your project.