tolo/EXAMPLES.md
selamanapps 40a80a6c9b Initial release: Tolo v1.0.0
- Add core CLI functionality (save, run, update, delete, list, show, search)
- Implement JSON-based storage in ~/.tolo/tolo.db.json
- Add beautiful terminal UI with colors and icons
- Support command shortcuts (s, r, u, d, ls, l, sh, se, h, v)
- Add Bash and Zsh shell completion
- Include comprehensive documentation (README, CONTRIBUTING, SECURITY)
- Set up CI/CD workflows with GitHub Actions
- Add installation script and Makefile for build automation
- MIT License

Made with ❤️ at Zemenawi Lab
2026-03-27 06:44:03 +03:00

4.4 KiB

Tolo Examples

This file contains practical examples of using Tolo in various scenarios.

SSH Connections

Simple SSH

# Save
tolo s myserver:ssh user@192.168.1.10

# Run
tolo r myserver

SSH with Custom Port

tolo s myserver:ssh user@192.168.1.10 -p 2222

SSH with Key File

tolo s myserver:ssh user@192.168.1.10 -i ~/.ssh/mykey.pem

SSH with Multiple Options

tolo s production:ssh -i ~/.ssh/prod-key -p 2222 admin@prod.example.com

Cloud Services

Google Cloud

# Save gcloud SSH connection
tolo s gcloud-ssh:gcloud compute ssh instance-1 --zone us-central1-a --project my-project

# Save gcloud deployment
tolo s gcloud-deploy:gcloud app deploy

AWS

# Save AWS SSM
tolo s aws-ssm:aws ssm start-session --target i-0123456789abcdef0

# Save AWS deployment
tolo s aws-deploy:aws lambda update-function-code --function-name my-function

Azure

# Save Azure SSH
tolo s azure-vm:az vm ssh --resource-group myRG --name myVM

Docker

Start Containers

tolo s dev:docker-compose up -d
tolo s prod:docker-compose -f docker-compose.prod.yml up -d

Build and Run

tolo s rebuild:docker-compose up -d --build

Docker Commands

tolo s logs:docker-compose logs -f
tolo s stop:docker-compose down

Development

Git Commands

# Save complex git command
tolo s git-stats:git shortlog -sn --all

# Save git push to origin
tolo s gp:git push origin $(git branch --show-current)

Build Commands

# Save Go build
tolo s go-build:go build -ldflags="-s -w" -o myapp

# Save Node build
tolo s npm-build:npm run build && npm run test

Testing

# Save test command
tolo s test-all:go test ./... -race -cover

System Administration

System Update

tolo s update:sudo apt update && sudo apt upgrade -y

Backup

tolo s backup:rsync -avz /home/user/ /backup/user/

Log Monitoring

tolo s logs:tail -f /var/log/syslog

System Check

tolo s sysinfo:htop

Database

PostgreSQL

# Save psql connection
tolo s psql-prod:psql -h prod-db.example.com -U admin -d production

# Save backup
tolo s pg-backup:pg_dump -h localhost -U admin mydb > backup.sql

MongoDB

# Save mongo connection
tolo s mongo:mongo mongodb://localhost:27017/mydb

# Save backup
tolo s mongo-backup:mongodump --host localhost --db mydb --out /backup

Redis

# Save redis connection
tolo s redis-cli:redis-cli -h localhost -p 6379

File Operations

Transfer Files

tolo s sync:rsync -avz --progress source/ user@remote:/destination/

Archive

tolo s backup-tar:tar -czf backup-$(date +%Y%m%d).tar.gz /important/files/

Automation

Cron Jobs

# Add cron job
tolo s add-cron:crontab -e

# List cron jobs
tolo s list-cron:crontab -l

Batch Processing

# Process files
tolo s process:for f in *.txt; do convert "$f" "${f%.txt}.pdf"; done

Kubernetes

Kubectl Commands

# Save kubectl get pods
tolo s k-pods:kubectl get pods -A

# Save deployment command
tolo s k-deploy:kubectl apply -f deployment.yaml

Monitoring

Health Check

tolo s health:curl -f http://localhost:8080/health || exit 1

Server Status

tolo s status:systemctl status myservice

Tips and Tricks

Use Meaningful Names

# Good
tolo s prod-db-ssh:ssh admin@prod-db.example.com

# Bad
tolo s server1:ssh admin@192.168.1.10

Update Aliases

# When connection details change
tolo u prod-db-ssh:ssh admin@new-prod-db.example.com

Search Before Creating

# Check if alias exists
tolo se db

# Show existing alias details
tolo sh prod-db-ssh

Use Shell Variables in Commands

# Save with variable
tolo s test:echo $HOME

# When you run it, it will use your current $HOME

Migration from Shell Aliases

If you have existing shell aliases, migrate them to Tolo:

# In .bashrc:
alias server1='ssh user@192.168.1.10'

# Migrate to Tolo:
tolo s server1:ssh user@192.168.1.10

# Now remove from .bashrc and use Tolo instead

Backup Your Aliases

# Tolo stores aliases in ~/.tolo/tolo.db.json
# Simply copy this file to backup:

cp ~/.tolo/tolo.db.json ~/backup/tolo-backup.json

Restore Aliases

# Restore from backup
cp ~/backup/tolo-backup.json ~/.tolo/tolo.db.json