A powerful CLI tool designed to simplify and shorten repetitive DevOps terminal commands. opsbrew provides shortcuts for common Git and kubectl operations, with features like fuzzy finders, command recipes, and project templates.
Source: github.com/nghiadaulau/opsbrew
- Git Operations: Enhanced Git commands with fuzzy finder for branches
- Kubernetes Management: kubectl shortcuts with context/namespace switching, HPA management, and scaling
- File Operations: Common file operations like backup, diff, find, and grep
- Command Recipes: Save and run command macros for daily workflows
- Project Templates: Bootstrap common project structures
- Safe Defaults: Built-in
--dry-runand--confirmflags - Configuration: YAML-based configuration (global + per-repo)
- Shell Completions: Full shell completion support
# Install latest version
go install github.com/nghiadaulau/opsbrew@latest
# Add Go bin to PATH (if not already added)
echo 'export PATH=$PATH:$(go env GOPATH)/bin' >> ~/.bashrc
source ~/.bashrc
# Verify installation
opsbrew --version# Linux/macOS
wget https://github.com/nghiadaulau/opsbrew/releases/latest/download/opsbrew_Linux_x86_64.tar.gz
tar -xzf opsbrew_Linux_x86_64.tar.gz
sudo mv opsbrew /usr/local/bin/
# Windows
curl -L -o opsbrew_Windows_x86_64.zip https://github.com/nghiadaulau/opsbrew/releases/latest/download/opsbrew_Windows_x86_64.zip
# Extract and add to PATHgit clone https://github.com/nghiadaulau/opsbrew.git
cd opsbrew
go build -o opsbrew .
sudo mv opsbrew /usr/local/bin/📖 Detailed Installation Guide: See INSTALL.md for complete instructions including upgrade, uninstall, and troubleshooting.
This project uses GoReleaser for automated releases. When you push a tag starting with v*, it automatically:
- Builds binaries for Linux, macOS, and Windows
- Creates GitHub releases with all artifacts
- Generates checksums for verification
git tag v1.0.0
git push origin v1.0.0See RELEASE.md for detailed release instructions.
This project uses mdBook to generate beautiful documentation sites.
- Live Documentation: https://nghiadaulau.github.io/opsbrew
- Documentation Setup: See DOCUMENTATION.md for details
The documentation site includes:
- Complete command reference
- Installation guides
- Release information
- Interactive search
- Dark/light theme toggle
go install github.com/nghiadaulau/opsbrew@latest-
Initialize configuration:
opsbrew --help # This will create ~/.opsbrew.yaml with default settings -
Git operations:
opsbrew git status # Enhanced git status opsbrew git sync # git pull --rebase opsbrew git checkout # Fuzzy finder for branches
-
Kubernetes operations:
opsbrew k8s kctx # Switch kubectl context opsbrew k8s kns # Switch namespace opsbrew k8s klogs # Get pod logs with fuzzy finder opsbrew k8s khpa set-min my-hpa 2 # Set HPA min replicas opsbrew k8s kscale deployment my-app 5 # Scale deployment
-
Command recipes:
opsbrew brew save daily-sync # Save a new recipe opsbrew brew run daily-sync # Execute saved recipe opsbrew brew list # List all recipes
-
File operations:
opsbrew file backup config.yaml # Create backup opsbrew file find "*.yaml" # Find files by pattern opsbrew file diff file1.yaml file2.yaml # Compare files
-
Project templates:
opsbrew init github-actions my-app # Create GitHub Actions workflow opsbrew init k8s-deployment my-app # Create K8s Deployment opsbrew init k8s-service my-app # Create K8s Service
opsbrew uses YAML configuration files. The global config is located at ~/.opsbrew.yaml, and you can have per-repository configs in .opsbrew.yaml.
# Git configuration
git:
default_branch: "main"
auto_fetch: true
aliases:
st: "status"
co: "checkout"
sync: "pull --rebase"
# Kubernetes configuration
kubernetes:
default_context: "production"
context_aliases:
prod: "production-cluster"
dev: "development-cluster"
# Command recipes
brew:
recipes:
daily-sync:
description: "Daily development workflow"
commands:
- "git fetch --all"
- "git pull origin main"
- "git checkout -b feature/$(date +%Y%m%d)"
tags: ["daily", "git"]
# UI settings
ui:
colors: true
verbose: false
confirm: false
dry_run: falseopsbrew git status- Enhanced git status with colorsopsbrew git sync- Pull with rebaseopsbrew git checkout [branch]- Checkout branch with fuzzy finderopsbrew git branch- List branches with fuzzy finderopsbrew git fetch- Fetch all remotesopsbrew git pull- Pull from current branchopsbrew git push- Push to current branch
opsbrew k8s kctx [context]- Switch kubectl context with fuzzy finderopsbrew k8s kns [namespace]- Switch namespace with fuzzy finderopsbrew k8s klogs [pod]- Get pod logs with fuzzy finderopsbrew k8s kpods- List pods with fuzzy finderopsbrew k8s ksvc- List servicesopsbrew k8s kingress- List ingress resourcesopsbrew k8s kexec [pod] [command]- Execute command in podopsbrew k8s khpa list- List all HPAsopsbrew k8s khpa get [name]- Get HPA detailsopsbrew k8s khpa set-min [name] [value]- Set minimum replicasopsbrew k8s khpa set-max [name] [value]- Set maximum replicasopsbrew k8s khpa set-target [name] [value]- Set target CPU percentageopsbrew k8s kscale [type] [name] [replicas]- Scale deployment/replicaset/statefulset
opsbrew file open [file]- Open file with default editoropsbrew file find [pattern] [dir]- Find files by name or patternopsbrew file grep [pattern] [file]- Search for text in filesopsbrew file backup [file] [backup-path]- Create backup of fileopsbrew file diff [file1] [file2]- Show differences between files
opsbrew brew save [name]- Save a new recipeopsbrew brew list- List all saved recipesopsbrew brew run [name]- Execute a saved recipeopsbrew brew delete [name]- Delete a recipeopsbrew brew edit [name]- Edit a recipe
opsbrew init github-actions [name]- Create GitHub Actions workflowopsbrew init k8s-deployment [name]- Create Kubernetes Deployment manifestopsbrew init k8s-service [name]- Create Kubernetes Service manifestopsbrew init k8s-pod [name]- Create Kubernetes Pod manifestopsbrew init k8s-configmap [name]- Create Kubernetes ConfigMap manifestopsbrew init dockerfile [name]- Create multi-stage Dockerfileopsbrew init list- List available templates
--config- Specify config file path--verbose, -v- Enable verbose output--dry-run- Show what would be done without executing--confirm- Skip confirmation prompts
Generate shell completions:
# Bash
opsbrew completion bash > ~/.bash_completion.d/opsbrew
# Zsh
opsbrew completion zsh > "${fpath[1]}/_opsbrew"
# Fish
opsbrew completion fish > ~/.config/fish/completions/opsbrew.fish
# PowerShell
opsbrew completion powershell > opsbrew.ps1# Start the day
opsbrew brew run daily-sync
# Check git status
opsbrew git status
# Switch to a feature branch
opsbrew git checkout
# Switch to development context
opsbrew k8s kctx dev
# Check pod logs
opsbrew k8s klogs
# Manage HPA settings
opsbrew k8s khpa set-min my-app 2
opsbrew k8s khpa set-max my-app 10
# Scale deployment
opsbrew k8s kscale deployment my-app 5
# File operations
opsbrew file backup config.yaml
opsbrew file find "*.yaml"# Pre-deployment checks
opsbrew brew run deploy-check
# Switch to production context
opsbrew k8s kctx prod
# Check application status
opsbrew k8s kpods
opsbrew k8s ksvc# Create GitHub Actions workflow
opsbrew init github-actions my-api
# Create Kubernetes manifests
opsbrew init k8s-deployment my-api
opsbrew init k8s-service my-api
opsbrew init k8s-configmap my-api
# Create Dockerfile
opsbrew init dockerfile my-api- Go 1.24 or later
- Git
- kubectl (for Kubernetes commands)
git clone https://github.com/nghiadaulau/opsbrew.git
cd opsbrew
go mod download
go build -o opsbrew .go test ./...- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- spf13/cobra - CLI framework
- ktr0731/go-fuzzyfinder - Fuzzy finder
- fatih/color - Color output
- spf13/viper - Configuration management