slot

command module
v0.0.19 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2025 License: MIT Imports: 3 Imported by: 0

README

slot

slot logo

Save and render named shell commands


GitHub release Go Reference Go Report Card Build Status

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

Installation

curl -sSL https://raw.githubusercontent.com/idelchi/slot/refs/heads/main/install.sh | sh -s -- -d ~/.local/bin

Usage

# Save a command with Go template variables
$ slot save deploy 'kubectl apply -f {{.file}}' --tags k8s --tags prod --description 'deploy to prod'
# 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 deploy

Data Storage

Slots are stored in YAML format at ~/.config/slot/slots.yaml. Location can be overridden with the --config flag or SLOTS_FILE environment variable.

Shell Integration

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.

Commands

save — Save a command slot
  • Usage: slot save <name> <command> [flags]
  • Flags:
    • --tags – Tags for the slot (repeatable)
    • --description – Description for the slot
    • --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)

Templating

In addition to your own key=value arguments, the following variables are always available inside templates:

  • SLOTS_FILE – Full path to the slots YAML file
  • SLOTS_DIR – Directory containing the slots YAML file
  • CLI_ARGS – All arguments after --, joined into a single space-delimited string
  • CLI_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.

Demo

Demo

Documentation

Overview

Slot saves and renders named shell commands with Go template substitution.

Store frequently used commands with template variables and tags for quick execution. Render commands with variable substitution and integrate with your shell for seamless workflow.

Usage:

slot [command] [flags]

Use "slot --help" for more information.

Directories

Path Synopsis
internal
cli
Package cli implements the command-line interface for slot.
Package cli implements the command-line interface for slot.
integration
Package integration provides embedded shell integration snippets.
Package integration provides embedded shell integration snippets.
render
Package render provides Go template parsing and execution for command string substitution.
Package render provides Go template parsing and execution for command string substitution.
slot
Package slot defines the data structures for slot command storage.
Package slot defines the data structures for slot command storage.
store
Package store provides persistent storage operations for slot data with atomic file operations.
Package store provides persistent storage operations for slot data with atomic file operations.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL