@mckinleymedia/cli-maker
v1.0.0
Published
Auto-generate CLIs from a folder of commands
Downloads
5
Maintainers
Readme
cli-maker
A tool to automatically generate CLIs from a folder of command scripts.
Installation
npm install -g @mckinleymedia/cli-makerUsage
cli-maker <name> [options]Options
-c, --commands <path>- Path to commands directory (default:./commands)-t, --typescript- Generate TypeScript CLI (default: false)-h, --help- Show help-V, --version- Show version
Example
# Generate a CLI called "mycli" from the example-commands folder
cli-maker mycli -c ./example-commands
# The CLI is immediately ready to use!
mycli --help
mycli hello WorldHow it works
- Command Discovery: cli-maker scans your commands directory for scripts (
.sh,.js,.ts,.py) - Description Extraction: It extracts descriptions from comments in your scripts (format:
# Description: Your description here) - CLI Generation: Creates a fully functional Node.js CLI with:
- Command routing
- Interactive mode with arrow key navigation
- Colored output
- Automatic argument detection
- Help menu
- Support for multiple script types
- Automatic Installation: The CLI is installed globally with no manual steps required
Command Script Format
Your command scripts should include a description comment:
#!/usr/bin/env bash
# Description: This is what my command does
# Your script logic here
echo "Hello from my command!"Generated CLI Features
The generated CLI includes:
- Direct command execution:
mycli <command> [args] - Interactive mode: Just run
mycliwithout arguments- Arrow key navigation
- Colored command list
- Automatic argument prompting for commands that need them
- Help menu:
mycli --help - Automatic script type detection (bash, node, ts-node, python3)
- Smart argument detection - knows which commands accept arguments
License
MIT
