# rbam - Rust Bash Alias Manager
A fast, simple CLI tool to manage your bash aliases, perfect for SSH shortcuts and frequently used commands.
## Why rbam?
- 🚀 **Fast** - Written in Rust for blazing speed
- 🎯 **Simple** - Intuitive commands to add, list, and execute aliases
- 🔧 **Practical** - Built for developers who SSH into multiple servers
- 📝 **Clean** - Manages your `.bash_aliases` file automatically
## Installation
### From crates.io
```bash
cargo install rbam
```
### From source
```bash
git clone https://github.com/yourusername/rbam
cd rbam
cargo install --path .
```
## Quick Start
```bash
# Add your first alias
rbam add
# Name: prod-server
# Command: ssh deploy@production.example.com
# List all aliases
rbam list
# List with full commands
rbam list --full
# Execute an alias
rbam exec prod-server
```
After adding aliases, reload your shell:
```bash
source ~/.bash_aliases
```
## Usage
### Add Alias
Interactive mode - prompts for name and command:
```bash
rbam add
```
Example session:
```
Name: cdn-staging
Command: ssh -p 2222 deploy@cdn.staging.example.com
✓ Added alias: cdn-staging
To use immediately, run:
source ~/.bash_aliases
```
### List Aliases
Show alias names only:
```bash
rbam list
```
Output:
```
cdn-staging
prod-server
db-backup
```
Show full details:
```bash
rbam list --full
```
Output:
```
alias cdn-staging='ssh -p 2222 deploy@cdn.staging.example.com'
alias prod-server='ssh deploy@production.example.com'
alias db-backup='ssh root@backup.example.com'
```
### Execute Alias
Run a command from an alias without sourcing:
```bash
rbam exec cdn-staging
```
Useful for testing before sourcing your shell.
## Common Use Cases
### SSH Shortcuts
```bash
rbam add
# Name: prod
# Command: ssh deploy@prod.example.com
rbam add
# Name: staging
# Command: ssh deploy@staging.example.com -p 2222
```
### Docker Commands
```bash
rbam add
# Name: dps
# Command: docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
```
### Git Shortcuts
```bash
rbam add
# Name: gst
# Command: git status -sb
```
### Directory Navigation
```bash
rbam add
# Name: proj
# Command: cd ~/projects/myapp && ls
```
## File Location
rbam manages your `.bash_aliases` file located at:
```
~/.bash_aliases
```
This file is automatically sourced by `.bashrc` on most systems.
## Requirements
- Rust 1.70 or higher (for building from source)
- Bash shell
- Linux or macOS
## Platform Support
- ✅ Linux
- ✅ macOS
- ⚠️ Windows (via Git Bash or WSL)
## Configuration
rbam stores aliases in `~/.bash_aliases`. No additional configuration needed.
## Building from Source
```bash
# Clone the repository
git clone https://github.com/yourusername/rbam
cd rbam
# Run tests
cargo test
# Build release
cargo build --release
# Binary will be at
./target/release/rbam
```
## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
### Development Setup
1. Fork the repository
2. Clone your fork: `git clone https://github.com/yourusername/rbam`
3. Create a branch: `git checkout -b feature/my-feature`
4. Make changes and add tests
5. Run tests: `cargo test`
6. Format code: `cargo fmt`
7. Check with clippy: `cargo clippy`
8. Commit: `git commit -m "Add my feature"`
9. Push: `git push origin feature/my-feature`
10. Open a Pull Request
## Roadmap
- [ ] Remove alias command
- [ ] Search/filter aliases
- [ ] Import/export aliases
- [ ] Shell completion (bash, zsh, fish)
- [ ] Edit alias interactively
- [ ] Backup and restore
- [ ] Windows PowerShell support
## FAQ
**Q: Where are my aliases stored?**
A: In `~/.bash_aliases` in your home directory.
**Q: How do I remove an alias?**
A: Currently, manually edit `~/.bash_aliases`. Remove command coming soon!
**Q: Do I need to restart my terminal?**
A: No, just run `source ~/.bash_aliases` to reload.
**Q: Can I use this with zsh?**
A: Yes! Add `source ~/.bash_aliases` to your `~/.zshrc`.
**Q: What if I already have a .bash_aliases file?**
A: rbam appends to it, preserving existing aliases.
## License
MIT License - see [LICENSE](LICENSE) file for details.
## Author
Your Name - [@yourhandle](https://github.com/yourusername)
## Acknowledgments
- Built with [Rust](https://www.rust-lang.org/)
- Inspired by the need for simpler SSH alias management
---
**Star ⭐ this repo if you find it useful!**