DEV Community

Cover image for I Built a Command Manager for the Terminal (And You Might Need It Too)
ddev94
ddev94

Posted on

I Built a Command Manager for the Terminal (And You Might Need It Too)

GitHub: https://github.com/ddev94/pock

We've all been there. You're in the terminal, trying to remember that one git command you use every week. You scroll through your shell history, squint at old notes, or just Google it again.

I got tired of this workflow, so I built Pock – a simple CLI tool that lets you save, organize, and reuse your terminal commands.

The Problem

As developers, we use the terminal constantly, but our command workflows are messy:

  • Shell history is hard to navigate and doesn't persist well
  • Aliases are session-specific and don't handle complex scripts
  • Documentation gets outdated or lost in random files
  • Scripts are scattered across different directories

We need a better way to manage our command toolkit.

Introducing Pock

Pock is a command manager that works like bookmarks for your terminal. Save any command with a simple name, run it instantly, and keep a full history of executions.

Quick Start

Install directly from GitHub releases:

curl -o- https://raw.githubusercontent.com/ddev94/pock/main/install.sh | bash
Enter fullscreen mode Exit fullscreen mode

or with wget:

wget -qO- https://raw.githubusercontent.com/ddev94/pock/main/install.sh | bash
Enter fullscreen mode Exit fullscreen mode

To install a specific version, pass it as an argument:

curl -o- https://raw.githubusercontent.com/ddev94/pock/main/install.sh | bash -s 1.0.2
Enter fullscreen mode Exit fullscreen mode

Core Features

1. Save Commands and Scripts

# Save inline commands
pock add sync-db "pg_dump production | psql development"

# Save script files (content is stored)
pock add release ./scripts/release.sh -d "Production release"
Enter fullscreen mode Exit fullscreen mode

2. Execution History
Every command run is logged with:

  • Timestamp
  • Exit code
  • Full stdout/stderr output
  • Execution duration
pock history deploy --output
Enter fullscreen mode Exit fullscreen mode

3. Import/Export
Share command libraries with your team:

# Export your commands
pock export my-commands.json

# Team members import them
pock import my-commands.json
Enter fullscreen mode Exit fullscreen mode

Why Go?

I chose Go for several reasons:

  • Single binary distribution (no dependencies)
  • Great CLI tooling (Cobra, Viper)
  • Cross-platform compilation
  • Fast startup time
  • Easy to install

Technical Architecture

pock/
├── cmd/           # Cobra commands
├── internal/
│   ├── storage/   # SQLite database layer
│   └── helpers/   # Config and utilities
└── pkg/           # Public packages
Enter fullscreen mode Exit fullscreen mode

Storage: SQLite (via bbolt/bolt) for local data

CLI Framework: Cobra + Viper

Output Capture: Custom exec wrapper

Real-World Usage

Here's how I use Pock daily:

# Development workflow
pock add dev "docker-compose up -d && npm run dev"
pock add test "npm run lint && npm test && npm build"

# Database tasks
pock add db-backup "./scripts/backup-db.sh"
pock add db-reset "dropdb myapp && createdb myapp && npm run migrate"

# Deployment
pock add deploy-staging "./deploy.sh staging"
pock add deploy-prod "./deploy.sh production"
Enter fullscreen mode Exit fullscreen mode

What's Next?

I'm actively working on:

  • Community marketplace for sharing commands
  • Command scheduling/cron integration
  • Team collaboration features
  • VS Code extension
  • Web UI for command management

Try It Out!

GitHub: https://github.com/ddev94/pock

Feedback Welcome!

I'd love to hear:

  • What commands would you save first?
  • What features are missing?
  • Any bugs or issues you encounter

Drop a comment or open an issue on GitHub! ⭐


Built with Go. Open source (ISC License). Privacy-focused.

Top comments (0)