Skip to content

mckinleymedia/cli-maker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cli-maker

A tool to automatically generate CLIs from a folder of command scripts.

Installation

npm install -g @mckinleymedia/cli-maker

Usage

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 World

How it works

  1. Command Discovery: cli-maker scans your commands directory for scripts (.sh, .js, .ts, .py)
  2. Description Extraction: It extracts descriptions from comments in your scripts (format: # Description: Your description here)
  3. 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
  4. 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 mycli without 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

About

A tool to automatically generate CLIs from a folder of command scripts

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors