Save and render named shell commands
slot is a command-line tool for saving, organizing, and executing templated shell commands.
- Save commands with Go template variables and tags for organization in a simple YAML file
- Render commands with variable substitution using
KEY=VAL - Shell integration places rendered commands into your prompt for execution
curl -sSL https://raw.githubusercontent.com/idelchi/slot/refs/heads/main/install.sh | sh -s -- -d ~/.local/bin# Save a command with Go template variables
$ slot save deploy 'kubectl apply -f {{.file}}' --tags k8s --tags prod --description 'deploy to prod'# Save a command with default variables
$ slot save deploy 'kubectl apply -f {{.file}} -n {{.namespace}}' --var file=k8s.yml --var namespace=default# Render a command with variable substitution
$ slot render deploy file=k8s.yml
kubectl apply -f k8s.yml# List all saved slots
$ slot list
NAME CMD TAGS DESCRIPTION
deploy kubectl apply -f {{.file}} k8s,prod deploy to prod# List slots filtered by tags
$ slot list --tags k8s# Remove a slot
$ slot remove deploySlots are stored in YAML format at ~/.config/slot/slots.yaml. Location can be overridden with the
--config flag or SLOTS_FILE environment variable.
Generate shell integration snippets for command placement:
# Generate integration
$ slot init <shell>The integration enables the slot run command which places rendered output
into your shell prompt for editing before execution.
Use --yes/-y to execute the rendered command directly without editing.
Adding the --fzf flag enables further integration, binding Ctrl-X and Ctrl-Z keys to running or searching slots.
save — Save a command slot
- Usage:
slot save <name> <command> [flags] - Flags:
--tags– Tags for the slot (repeatable)--description– Description for the slot--var– Default template variable askey=value(repeatable)--force– Overwrite existing slot
render — Render a saved command slot
- Usage:
slot render <name> [key=value...]
list/ls — List saved slots
-
Usage:
slot list [flags] -
Flags:
--tags– Filter by tags (repeatable)--tsv– Output in TSV format
remove/rm — Delete a saved slot
- Usage:
slot remove <name>
init — Generate shell integration snippets
- Usage:
slot init <bash|zsh> [flags] - Flags:
--fzf– Enable fzf integration (binds to Ctrl-X and Ctrl-Z keys)
In addition to your own key=value arguments, the following variables are always available inside templates:
SLOTS_FILE– Full path to the slots YAML fileSLOTS_DIR– Directory containing the slots YAML fileCLI_ARGS– All arguments after--, joined into a single space-delimited stringCLI_ARGS_SPLIT– Same arguments as above, but preserved as a list ([]string) for iteration
All templates use Go’s text/template syntax, with extra functions from slim-sprig.
Slots can define default variables with vars. Command-line key=value arguments override slot variables.
slots:
- name: deploy
description: Deploy manifest
cmd: kubectl apply -f {{.file}} -n {{.namespace}}
vars:
file: k8s.yml
namespace: default
tags:
- k8sVariable precedence is:
- Slot
vars - Built-in variables such as
SLOTS_FILEandSLOTS_DIR - Command-line
key=valuearguments
To include other slot files, use include:
include:
- ./shared.yaml
- ./team/slots.yaml
slots:
- name: deploy
cmd: kubectl apply -f {{.file}}
vars:
file: k8s.ymlInclude paths are resolved relative to the file that declares them.
Recursive includes fail with an error. list and render can use included slots.
save writes new slots to the root slots file; remove deletes the visible slot from whichever file defines it.

