save is a powerful command-line tool that helps developers track, manage, and reuse their shell commands with additional context and organization features. It's designed to be a more intelligent alternative to basic shell history, offering tagging, searching, and analytics capabilities.
- Go 1.21 or higher
- Git
- Make (for Unix/Linux/macOS)
curl -sSL https://raw.githubusercontent.com/t-rhex/save-go/main/install.sh | bash
# Run as administrator
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/t-rhex/save-go/main/install.ps1')
- Clone and Build:
git clone https://github.com/t-rhex/save-go.git
cd save-go
- Choose Installation Method:
User Installation (Recommended, no sudo required):
make user-install
System-wide Installation (Requires sudo):
make install
# Build
go build -o save.exe
# Copy to a directory in your PATH (e.g., %USERPROFILE%\AppData\Local\save)
$installPath = "$env:USERPROFILE\AppData\Local\save"
New-Item -ItemType Directory -Force -Path $installPath
Copy-Item save.exe -Destination "$installPath\save.exe"
# Add to PATH if not already there
$userPath = [Environment]::GetEnvironmentVariable("Path", "User")
if ($userPath -notlike "*$installPath*") {
[Environment]::SetEnvironmentVariable("Path", "$userPath;$installPath", "User")
}
- Add to Shell (if using user installation):
# For Bash
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
echo '[[ -f ~/.bash_completion.d/save ]] && . ~/.bash_completion.d/save' >> ~/.bashrc
# For Zsh
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
echo 'fpath=(~/.zsh/completion $fpath)' >> ~/.zshrc
# Add to PowerShell profile
if (!(Test-Path $PROFILE)) { New-Item -Type File -Force $PROFILE }
Add-Content $PROFILE "`$env:Path = [Environment]::GetEnvironmentVariable('Path', 'User')"
# Setup completion
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\Documents\WindowsPowerShell\Completions"
save --generate-completion powershell > "$env:USERPROFILE\Documents\WindowsPowerShell\Completions\save.ps1"
- Reload Shell:
source ~/.bashrc # or source ~/.zshrc for Zsh
# Reload PATH
$env:Path = [Environment]::GetEnvironmentVariable("Path", "User")
# Save and run a command
save 'echo "Hello World"'
# Save with tags and description
save --tag docker,prod --desc 'Start services' 'docker-compose up'
# List recent commands
save --list
# Search commands
save --search "docker"
- β¨ Command execution and storage with metadata
- π Only successful commands are saved
- π Directory context tracking
- π·οΈ Tagging system
- π Interactive command mode
- π Command descriptions
- β Favorite commands
- π Command rerunning
- π Usage statistics
- πΎ Backup and restore functionality
- π οΈ Data integrity verification
- π Command duplication prevention
- π Command chains with dependencies
- β‘ Parallel execution support
- π― Conditional execution
- β° Time-based execution
- π Undo support
- π Analytics and insights
- π Similar command detection
# Enter interactive mode
save --interactive
# or
save -i
# Available commands in interactive mode:
help # Show help message
exit # Exit interactive mode
clear # Clear the screen
list # List recent commands
tags # Show available tags
# Save with current directory
save --dir 'npm start'
# Add tags to existing command
save --add-tags 42 git,prod
# Mark as favorite
save --favorite 42
# Edit command interactively
save --interactive-edit 42
# List favorite commands
save --list-favorites
# Create backup
save --backup
# List available backups
save --list-backups
# Restore from backup
save --restore backup-20240321-123456.json
# Verify data integrity
save --verify
# Create deployment chain
save --create-chain 'deploy' 'Deploy to prod' steps.json deps.json
# Run chain
save --run-chain 1
# Run chain ignoring errors
save --run-chain 1 --continue-on-error
# Search by tag
save --filter-tag docker
# View statistics
save --stats
# Export history
save --export history.json
- Config:
~/.config/save/config.json
- History:
~/.save_history.json
- Backups:
~/.config/save/backups/
- Completions:
- Bash:
~/.bash_completion.d/save
- Zsh:
~/.zsh/completion/_save
- Bash:
SAVE_CONFIG_PATH # Custom config file location
SAVE_HISTORY_PATH # Custom history file location
SAVE_NO_COLOR # Disable color output
SAVE_BACKUP_PATH # Custom backup directory location
- Config:
~/.config/save/config.json
- History:
~/.save_history.json
- Backups:
~/.config/save/backups/
- Completions:
- Bash:
~/.bash_completion.d/save
- Zsh:
~/.zsh/completion/_save
- Bash:
- Binary:
%USERPROFILE%\bin\save.exe
- Config:
%USERPROFILE%\AppData\Local\save\config.json
- History:
%USERPROFILE%\AppData\Local\save\history.json
- Completions:
%USERPROFILE%\Documents\WindowsPowerShell\Completions\save.ps1
- Binary:
C:\Program Files\save\save.exe
- Config:
C:\ProgramData\save\config.json
- History:
C:\ProgramData\save\history.json
# Update to latest version
curl -sSL https://raw.githubusercontent.com/t-rhex/save-go/main/install.sh | bash
# Update to latest version
# Run as administrator for system-wide installation
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/t-rhex/save-go/main/install.ps1')
# Or for user installation
$InstallType = "user"
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/t-rhex/save-go/main/install.ps1')
- Command not found
# Add to PATH
export PATH="$HOME/.local/bin:$PATH"
- No shell completion
# Reload shell completion
source ~/.bashrc # or source ~/.zshrc for Zsh
- Permission denied
# Fix permissions
chmod +x $HOME/.local/bin/save
- Duplicate commands
# Use --dir flag to save same command in different directory context
save --dir 'npm start'
# Or use --rerun to execute existing command
save --rerun <command_id>
- Command not found on Windows
# Add to PATH for current session
$env:Path = [Environment]::GetEnvironmentVariable('Path', 'User')
# Or permanently add to PATH
[Environment]::SetEnvironmentVariable(
"Path",
[Environment]::GetEnvironmentVariable("Path", "User") + ";$env:USERPROFILE\bin",
"User"
)
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature
) - Commit changes (
git commit -m 'Add amazing feature'
) - Push branch (
git push origin feature/amazing-feature
) - Open Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by shell history management tools
- Built with Go's robust standard library
- Community feedback and contributions
- π Report Bug
- π‘ Request Feature
- π§ Email Support