rex
Auto-discover your local scripts and run them as a structured CLI.
Rex π¦
Rex is a CLI tool that auto-discovers executable scripts from configured directories and exposes
them as a structured command interface. Point it at any directory of scripts and it builds a
parent rex command on top of them β topics, subtopics, and standalone commands, all derived
from the directory layout.
I built Rex because I kept forgetting what Iβd named a given automation script and ended up digging through folders to find it. With Rex, finding and running the right one is a tab-complete away.
Setup
Point Rex at a directory of scripts:
rex dirs add ~/scripts
Rex automatically discovers topics and commands from any directories youβve added. Multiple directories are supported and merged into the same namespace.
How Rex works
Rex uses directory layout to build a topic/subtopic command structure.
~/scripts/
βββ nas/ # Topic: nas
β βββ nas-mount.sh # β rex nas mount
β βββ nas-sync.sh # β rex nas sync
β βββ backup/ # Subtopic: backup (requires max_depth >= 2)
β βββ backup-create.sh # β rex nas backup create
β βββ backup-restore.sh # β rex nas backup restore
βββ network/ # Topic: network
β βββ network-stats.sh # β rex network stats
β βββ network-speed.sh # β rex network speed
βββ stock-stats.sh # β rex stock-stats (standalone)
- Topics / subtopics β nested subdirectories become command groups, up to
max_depth. - Commands β executable scripts inside a topic dir become subcommands. The leaf topic
prefix is auto-stripped if youβve added it to the filename (e.g.
nas-mount.shβmount). - Standalone β executables in the root of a configured directory become top-level commands.
Usage
rex # Show help
rex list # List all commands
rex <topic> <command> [args...] # Run a topic command
rex <topic> <subtopic> <command> [args...] # Run a subtopic command (if max_depth allows)
rex <command> [args...] # Run a standalone command
rex new <command> # Create a standalone script
rex new <topic> [subtopic...] <command> # Create a topic/subtopic script
rex edit <command> # Open a script in $EDITOR
rex edit <topic> [subtopic...] <command> # Open a topic/subtopic script in $EDITOR
Managing directories
rex dirs # List configured directories
rex dirs add <path> # Add a scripts directory
rex dirs remove <path> # Remove a scripts directory
Documentation
- Config β config file,
max_depth, multi-directory edge cases - Script integration β descriptions, Raycast compat,
rex.ignore, shell completions
License
MIT β see LICENSE.