cmdy-0.2.3 is not a library.
cmdy
A simple CLI tool to manage, select, and execute predefined shell command snippets.
Features
- Define command snippets in TOML files and organize them in directories
- Interactive fuzzy search using fzf (with ANSI colors, reversed layout, rounded border, 50% height by default)
- Filter snippets by tags
- Run snippets directly from the selection menu
editsubcommand: open a snippet's source file in your$EDITORclipsubcommand: copy a snippet's command to the system clipboard
Install
Requires Rust and cargo.
Quickstart
- Create a snippets directory (default location is
$XDG_CONFIG_HOME/cmdy/commandsor~/.config/cmdy/commands). - Add one or more
.tomlfiles with snippet definitions (see Defining Snippets below). - Run:
- Type to filter, select a snippet, and press Enter to execute it.
Subcommands
cmdy edit— Launch your$EDITORon the selected snippet's TOML file.cmdy clip— Copy the selected snippet'scommandstring to your clipboard.
Flags
--dir <DIRECTORY>— Specify a custom snippets directory (overrides default).-t, --tag <TAG>— Show only snippets tagged with<TAG>(can be repeated).-q, --query <QUERY>— Pre-populate the initial filter query for the interactive selector. This works withfzfandgum(PRs welcome for other filtering tools).--dry-run— Show the command that would be executed without actually running it. Useful for verifying commands before execution.
Configuration
Global settings are loaded from cmdy.toml in your config directory ($XDG_CONFIG_HOME/cmdy/cmdy.toml or ~/.config/cmdy/cmdy.toml).
Example cmdy.toml:
# Command used for interactive filtering
= "fzf --ansi --layout=reverse --border=rounded --height=50%"
# Additional snippet directories to scan
= ["/path/to/other/snippets"]
Defining Snippets
Create one or more .toml files in your snippets directory, using the [[commands]] table:
[[]]
= "List all files with details"
= "ls -lAh --color=auto"
= ["files", "list"]
[[]]
= "Show current date and time"
= "date '+%Y-%m-%d %H:%M:%S'"
Files without valid [[commands]] tables are skipped, and duplicate description names across files will error.
Development
Clone the repo and build:
Ensure you have fzf installed in your PATH for interactive selection.
Development Commands
# Run tests
# Run linting
# Format code
# Run with debug output
RUST_LOG=debug
# Build release version
# Check for security vulnerabilities
Project Structure
cmdy/
├── src/ # Source code
│ ├── main.rs # Entry point and CLI parsing
│ ├── config.rs # Configuration management
│ ├── types.rs # Data structures
│ ├── loader.rs # TOML file loading
│ ├── ui.rs # User interface and selection
│ └── executor.rs # Command execution
├── tests/ # Integration tests
├── examples/ # Example command files
├── .github/ # CI/CD workflows
└── Cargo.toml # Project manifest
Release Process
# patch, or minor, or major
If a release fails CI on GitHub, delete the tag and retry:
# Fix the issue, then re-release
License
Distributed under the MIT License. See LICENSE for details.