qcl (Quick Command Launcher) is a CLI tool that helps you select and execute command snippets efficiently in your terminal.
Snippets are managed in YAML files, and you can dynamically embed values through interactive prompts and selections.
Our goal is to enable error-free and effortless CLI operations without the need to memorize commands.
- 🔖 Define command snippets in YAML
- ✏️ Interactive input and selection for placeholders
- 🏗️ Use
functionto batch select and split multiple values automatically - 📂 Load additional snippet files with the
-foption (with priority handling) - 🛠️ Automatically generate a default snippet file at
~/.config/qcl/snippets.yaml
git clone --depth 1 https://github.com/nakkiy/qcl ~/.qcl
cd ~/.qcl
cargo install --path .After installation, make sure $HOME/.cargo/bin is included in your PATH:
export PATH="$HOME/.cargo/bin:$PATH"Copy the sample snippets.yaml:
mkdir ~/.config/qcl/
cp ~/.qcl/sample/snippets.yaml ~/.config/qcl/If you're using bash, you can bind ctrl + / to launch qcl by running:
echo "[ -f ~/.qcl/shell/keybinding.bash ] && source ~/.qcl/shell/keybinding.bash" >> ~/.bashrcqcl- Choose a snippet
- Enter/select values for the placeholders
- View the final command
| Option | Description |
|---|---|
-f, --file |
Load an additional YAML file. Snippets with duplicate keys are overridden by this file. |
Example:
qcl -f ./my_snippets.yamlOn the first run, the following file is automatically generated:
~/.config/qcl/snippets.yaml
[[name=default]]
[[name from:"command" select:1 order:2]]
[[name from:function]]
| Parameter | Description |
|---|---|
name |
Placeholder name |
=default |
Default value |
from |
Use command output as selectable choices |
select |
Field index of the choice (starting from 0) |
order |
Specify the input/selection order (executed by ascending order) |
function |
See below |
With function, you can input multiple fields at once by a single selection.
It's handy when you want to retrieve and split multiple values together!
- Build an
sshconnection command by fetchingHostnameandUserfrom.ssh/config - Populate multiple fields from a single item in a list
- name: ssh-login-function
command: ssh [[user from:function]]@[[host from:function]]
function:
multi: true
from: >
awk '$1 == "Host" {
if (host != "" && hostname != "" && user != "")
print host, hostname, user
host=$2; hostname=""; user=""
}
$1 == "Hostname" {hostname=$2}
$1 == "User" {user=$2}
END {
if (host != "" && hostname != "" && user != "")
print host, hostname, user
}' ~/.ssh/config
select:
user: 2
host: 1- Executes the command defined in
function - Select one item from the result list
- Extract the specified fields with
select, and embed them into the placeholders insidecommand
- Add search functionality in each selection list
- Organize/search snippets by tags
Pull requests for improvements, suggestions, or new features are welcome!
Even sharing your own useful snippets is great too!
Feel free to open an Issue or PR 🙌
