README
ΒΆ
save - Command History Manager
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.
π Quick Install
Prerequisites
- Go 1.21 or higher
- Git
- Make (for Unix/Linux/macOS)
One-Line Installation
Linux/macOS
curl -sSL https://raw.githubusercontent.com/t-rhex/save-go/main/install.sh | bash
Windows (PowerShell)
# Run as administrator
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/t-rhex/save-go/main/install.ps1')
Manual Installation
- Clone and Build:
git clone https://github.com/t-rhex/save-go.git
cd save-go
- Choose Installation Method:
Unix/Linux/macOS:
User Installation (Recommended, no sudo required):
make user-install
System-wide Installation (Requires sudo):
make install
Windows:
# 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):
Unix/Linux/macOS:
# 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
Windows (PowerShell):
# 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:
Unix/Linux/macOS:
source ~/.bashrc # or source ~/.zshrc for Zsh
Windows:
# Reload PATH
$env:Path = [Environment]::GetEnvironmentVariable("Path", "User")
π Quick Start
# 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"
π Features
Core Features
- β¨ 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
Advanced Features
- π Command chains with dependencies
- β‘ Parallel execution support
- π― Conditional execution
- β° Time-based execution
- π Undo support
- π Analytics and insights
- π Similar command detection
Interactive Mode
# 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
π» Usage Examples
Basic Command Management
# 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
Backup and Restore
# Create backup
save --backup
# List available backups
save --list-backups
# Restore from backup
save --restore backup-20240321-123456.json
# Verify data integrity
save --verify
Command Chains
# 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 and Analytics
# Search by tag
save --filter-tag docker
# View statistics
save --stats
# Export history
save --export history.json
βοΈ Configuration
Default Paths
- Config:
~/.config/save/config.json
- History:
~/.save_history.json
- Backups:
~/.config/save/backups/
- Completions:
- Bash:
~/.bash_completion.d/save
- Zsh:
~/.zsh/completion/_save
- Bash:
Environment Variables
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
Unix/Linux:
- Config:
~/.config/save/config.json
- History:
~/.save_history.json
- Backups:
~/.config/save/backups/
- Completions:
- Bash:
~/.bash_completion.d/save
- Zsh:
~/.zsh/completion/_save
- Bash:
Windows:
User Installation (Default):
- 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
System Installation:
- Binary:
C:\Program Files\save\save.exe
- Config:
C:\ProgramData\save\config.json
- History:
C:\ProgramData\save\history.json
π Updates
Unix/Linux/macOS:
# Update to latest version
curl -sSL https://raw.githubusercontent.com/t-rhex/save-go/main/install.sh | bash
Windows:
# 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')
π Troubleshooting
Common Issues
- 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"
)
π€ Contributing
- 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
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Acknowledgments
- Inspired by shell history management tools
- Built with Go's robust standard library
- Community feedback and contributions
π¬ Support
- π Report Bug
- π‘ Request Feature
- π§ Email Support
Documentation
ΒΆ
There is no documentation for this package.
Click to show internal directories.
Click to hide internal directories.