mirror of
https://github.com/shadoll/just-commons.git
synced 2025-12-20 00:25:43 +00:00
improove help
This commit is contained in:
@@ -1,5 +1,45 @@
|
||||
# Universal container management operations
|
||||
|
||||
# Define custom colors not in Just's native set
|
||||
DARK_GREY := '\033[2m' # Dark grey (dim) for optional parameters
|
||||
|
||||
alias help := default
|
||||
|
||||
# Default recipe - show available commands
|
||||
[no-cd]
|
||||
[private]
|
||||
default:
|
||||
#!/usr/bin/env bash
|
||||
echo "{{BOLD}}Container Management Commands{{NORMAL}}"
|
||||
echo ""
|
||||
echo "{{BOLD}}Usage:{{NORMAL}}"
|
||||
echo " just container <command> [service] [compose-file]"
|
||||
echo ""
|
||||
echo "{{BOLD}}Parameters:{{NORMAL}}"
|
||||
echo -e " {{YELLOW}}<required>{{NORMAL}} - Required parameter"
|
||||
echo -e " {{DARK_GREY}}[optional]{{NORMAL}} - Optional parameter"
|
||||
echo ""
|
||||
echo -e " {{DARK_GREY}}[service]{{NORMAL}} - Service name (if empty, applies to all services)"
|
||||
echo -e " {{DARK_GREY}}[compose-file]{{NORMAL}} - Path to compose file (if empty, uses default)"
|
||||
echo ""
|
||||
echo "{{BOLD}}Commands:{{NORMAL}}"
|
||||
echo -e " {{CYAN}}{{BOLD}}start{{NORMAL}} {{DARK_GREY}}[service] [compose-file]\033[0m - Start service(s)"
|
||||
echo -e " {{CYAN}}{{BOLD}}stop{{NORMAL}} {{DARK_GREY}}[service] [compose-file]\033[0m - Stop service(s)"
|
||||
echo -e " {{CYAN}}{{BOLD}}restart{{NORMAL}} {{DARK_GREY}}[service] [compose-file]\033[0m - Restart service(s)"
|
||||
echo -e " {{CYAN}}{{BOLD}}status{{NORMAL}} {{DARK_GREY}}[service] [compose-file]\033[0m - Show status"
|
||||
echo -e " {{CYAN}}{{BOLD}}logs{{NORMAL}} {{DARK_GREY}}[service] [compose-file]\033[0m - View logs"
|
||||
echo -e " {{CYAN}}{{BOLD}}shell{{NORMAL}} {{YELLOW}}<service>{{NORMAL}} {{DARK_GREY}}[compose-file]\033[0m - Open shell"
|
||||
echo -e " {{CYAN}}{{BOLD}}exec{{NORMAL}} {{YELLOW}}<service> <cmd>{{NORMAL}} {{DARK_GREY}}[compose-file]\033[0m - Execute command"
|
||||
echo -e " {{CYAN}}{{BOLD}}exec-pipe{{NORMAL}} {{YELLOW}}<service> <cmd>{{NORMAL}} {{DARK_GREY}}[compose-file]\033[0m - Execute with piped input"
|
||||
echo ""
|
||||
echo "{{BOLD}}Examples:{{NORMAL}}"
|
||||
echo " just container start # Start all services"
|
||||
echo " just container start myapp # Start specific service"
|
||||
echo " just container logs myapp # View logs for myapp"
|
||||
echo " just container shell myapp # Open shell in myapp"
|
||||
echo " just container status # Show all services status"
|
||||
echo ""
|
||||
|
||||
# Start service (or all services if no service specified)
|
||||
[no-cd]
|
||||
start service="" compose-file="":
|
||||
@@ -182,4 +222,4 @@ exec-pipe service cmd compose-file="":
|
||||
fi
|
||||
|
||||
echo -e "{{BLUE}}Executing in $service (with piped input): $cmd{{NORMAL}}"
|
||||
$compose_cmd $file_arg exec -T "$service" bash -c "$cmd"
|
||||
$compose_cmd $file_arg exec -T "$service" bash -c "$cmd"
|
||||
|
||||
@@ -1,6 +1,46 @@
|
||||
# Container images module - comprehensive image management
|
||||
# Supports multi-architecture builds, flexible naming, and registry operations
|
||||
|
||||
# Define custom colors not in Just's native set
|
||||
DARK_GREY := '\033[2m' # Dark grey (dim) for optional parameters
|
||||
|
||||
alias help := default
|
||||
|
||||
# Default recipe - show available commands
|
||||
[no-cd]
|
||||
[private]
|
||||
default:
|
||||
#!/usr/bin/env bash
|
||||
echo "{{BOLD}}Container Images Commands{{NORMAL}}"
|
||||
echo ""
|
||||
echo "{{BOLD}}Usage:{{NORMAL}}"
|
||||
echo " just images <command> [project] [tag]"
|
||||
echo ""
|
||||
echo "{{BOLD}}Parameters:{{NORMAL}}"
|
||||
echo -e " {{YELLOW}}<required>{{NORMAL}} - Required parameter"
|
||||
echo -e " {{DARK_GREY}}[optional]{{NORMAL}} - Optional parameter"
|
||||
echo ""
|
||||
echo -e " {{DARK_GREY}}[project]{{NORMAL}} - Project name (if empty, auto-discovers from current directory)"
|
||||
echo -e " {{DARK_GREY}}[tag]{{NORMAL}} - Image tag (if empty, generates from git commit or timestamp)"
|
||||
echo ""
|
||||
echo "{{BOLD}}Commands:{{NORMAL}}"
|
||||
echo -e " {{CYAN}}{{BOLD}}build{{NORMAL}} {{DARK_GREY}}[project] [tag]\033[0m - Build image with multi-architecture support"
|
||||
echo -e " {{CYAN}}{{BOLD}}push{{NORMAL}} {{DARK_GREY}}[project] [tag]\033[0m - Push image to registry"
|
||||
echo -e " {{CYAN}}{{BOLD}}pull{{NORMAL}} {{DARK_GREY}}[project] [tag]\033[0m - Pull image from registry"
|
||||
echo -e " {{CYAN}}{{BOLD}}tag{{NORMAL}} {{YELLOW}}<source_tag> <new_tag>{{NORMAL}} - Tag existing image with new tag"
|
||||
echo -e " {{CYAN}}{{BOLD}}info{{NORMAL}} {{DARK_GREY}}[project] [tag]\033[0m - Show image information"
|
||||
echo -e " {{CYAN}}{{BOLD}}list{{NORMAL}} {{DARK_GREY}}[project]\033[0m - List all project images"
|
||||
echo -e " {{CYAN}}{{BOLD}}clean{{NORMAL}} {{DARK_GREY}}[project]\033[0m - Remove project images (with confirmation)"
|
||||
echo -e " {{CYAN}}{{BOLD}}build-all{{NORMAL}} - Build all projects with Containerfiles"
|
||||
echo ""
|
||||
echo "{{BOLD}}Examples:{{NORMAL}}"
|
||||
echo " just images build # Build current project with auto-generated tag"
|
||||
echo " just images build myapp v1.0.0 # Build specific project with version tag"
|
||||
echo " just images push # Push current project latest build"
|
||||
echo " just images push latest # Push current project as latest"
|
||||
echo " just images list # List all images for current project"
|
||||
echo ""
|
||||
|
||||
# Build project image with multi-architecture support
|
||||
[no-cd]
|
||||
build project="" tag="":
|
||||
|
||||
@@ -1,5 +1,54 @@
|
||||
# Universal MySQL database operations
|
||||
|
||||
# Define custom colors not in Just's native set
|
||||
DARK_GREY := '\033[2m' # Dark grey (dim) for optional parameters
|
||||
|
||||
alias help := default
|
||||
|
||||
# Default recipe - show available commands
|
||||
[no-cd]
|
||||
[private]
|
||||
default:
|
||||
#!/usr/bin/env bash
|
||||
echo "{{BOLD}}MySQL Management Commands{{NORMAL}}"
|
||||
echo ""
|
||||
echo "{{BOLD}}Usage:{{NORMAL}}"
|
||||
echo " just mysql <command> [parameters]"
|
||||
echo ""
|
||||
echo "{{BOLD}}Parameters:{{NORMAL}}"
|
||||
echo -e " {{YELLOW}}<required>{{NORMAL}} - Required parameter"
|
||||
echo -e " {{DARK_GREY}}[optional]{{NORMAL}} - Optional parameter"
|
||||
echo ""
|
||||
echo -e " {{DARK_GREY}}[service]{{NORMAL}} - Service name (default: mysql)"
|
||||
echo -e " {{DARK_GREY}}[compose-file]{{NORMAL}} - Path to compose file"
|
||||
echo ""
|
||||
echo "{{BOLD}}Commands:{{NORMAL}}"
|
||||
echo -e " {{CYAN}}{{BOLD}}check{{NORMAL}} {{DARK_GREY}}[service] [compose-file]\033[0m - Check connection and status"
|
||||
echo -e " {{CYAN}}{{BOLD}}sql{{NORMAL}} {{YELLOW}}<query>{{NORMAL}} {{DARK_GREY}}[service] [compose-file]\033[0m - Execute SQL query"
|
||||
echo -e " {{CYAN}}{{BOLD}}shell{{NORMAL}} {{DARK_GREY}}[service] [compose-file]\033[0m - Open interactive shell"
|
||||
echo -e " {{CYAN}}{{BOLD}}list-databases{{NORMAL}} {{DARK_GREY}}[service] [compose-file]\033[0m - List all databases"
|
||||
echo -e " {{CYAN}}{{BOLD}}list-users{{NORMAL}} {{DARK_GREY}}[service] [compose-file]\033[0m - List all users"
|
||||
echo -e " {{CYAN}}{{BOLD}}create-database{{NORMAL}} {{YELLOW}}<database>{{NORMAL}} {{DARK_GREY}}[service] [compose-file]\033[0m - Create database"
|
||||
echo -e " {{CYAN}}{{BOLD}}drop-database{{NORMAL}} {{YELLOW}}<database>{{NORMAL}} {{DARK_GREY}}[service] [compose-file]\033[0m - Drop database (with confirmation)"
|
||||
echo -e " {{CYAN}}{{BOLD}}create-user{{NORMAL}} {{YELLOW}}<username> <password>{{NORMAL}} {{DARK_GREY}}[service] [compose-file]\033[0m - Create user"
|
||||
echo -e " {{CYAN}}{{BOLD}}grant-privileges{{NORMAL}} {{YELLOW}}<database> <username>{{NORMAL}} {{DARK_GREY}}[service] [compose-file]\033[0m - Grant privileges"
|
||||
echo -e " {{CYAN}}{{BOLD}}backup{{NORMAL}} {{YELLOW}}<database>{{NORMAL}} {{DARK_GREY}}[service] [compose-file] [backup_path] [name]\033[0m - Create backup"
|
||||
echo -e " {{CYAN}}{{BOLD}}restore{{NORMAL}} {{YELLOW}}<backup_file> <database>{{NORMAL}} {{DARK_GREY}}[service] [compose-file] [backup_path]\033[0m - Restore from backup"
|
||||
echo ""
|
||||
echo "{{RED}}⚠️ WARNING: drop-database and restore are DESTRUCTIVE operations!{{NORMAL}}"
|
||||
echo ""
|
||||
echo "{{BOLD}}Examples:{{NORMAL}}"
|
||||
echo " just mysql check # Check MySQL status"
|
||||
echo " just mysql sql \"SELECT VERSION();\" # Execute SQL query"
|
||||
echo " just mysql shell # Open interactive shell"
|
||||
echo " just mysql list-databases # List all databases"
|
||||
echo " just mysql create-database mydb # Create new database"
|
||||
echo " just mysql create-user myuser mypass # Create new user"
|
||||
echo " just mysql grant-privileges mydb myuser # Grant user access to database"
|
||||
echo " just mysql backup mydb # Backup database"
|
||||
echo " just mysql restore backup.sql mydb # Restore from backup"
|
||||
echo ""
|
||||
|
||||
# Execute MySQL SQL query
|
||||
[no-cd]
|
||||
sql query service="mysql" compose-file="":
|
||||
|
||||
@@ -1,5 +1,48 @@
|
||||
# Universal PostgreSQL database operations
|
||||
|
||||
# Define custom colors not in Just's native set
|
||||
DARK_GREY := '\033[2m' # Dark grey (dim) for optional parameters
|
||||
|
||||
alias help := default
|
||||
|
||||
# Default recipe - show available commands
|
||||
[no-cd]
|
||||
[private]
|
||||
default:
|
||||
#!/usr/bin/env bash
|
||||
echo "{{BOLD}}PostgreSQL Management Commands{{NORMAL}}"
|
||||
echo ""
|
||||
echo "{{BOLD}}Usage:{{NORMAL}}"
|
||||
echo " just postgres <command> [parameters]"
|
||||
echo ""
|
||||
echo "{{BOLD}}Parameters:{{NORMAL}}"
|
||||
echo -e " {{YELLOW}}<required>{{NORMAL}} - Required parameter"
|
||||
echo -e " {{DARK_GREY}}[optional]{{NORMAL}} - Optional parameter"
|
||||
echo ""
|
||||
echo -e " {{DARK_GREY}}[service]{{NORMAL}} - Service name (default: postgres)"
|
||||
echo -e " {{DARK_GREY}}[compose-file]{{NORMAL}} - Path to compose file"
|
||||
echo ""
|
||||
echo "{{BOLD}}Commands:{{NORMAL}}"
|
||||
echo -e " {{CYAN}}{{BOLD}}check{{NORMAL}} {{DARK_GREY}}[service] [compose-file]\033[0m - Check connection and status"
|
||||
echo -e " {{CYAN}}{{BOLD}}sql{{NORMAL}} {{YELLOW}}<query>{{NORMAL}} {{DARK_GREY}}[service] [compose-file]\033[0m - Execute SQL query"
|
||||
echo -e " {{CYAN}}{{BOLD}}shell{{NORMAL}} {{DARK_GREY}}[service] [compose-file]\033[0m - Open interactive shell"
|
||||
echo -e " {{CYAN}}{{BOLD}}list-databases{{NORMAL}} {{DARK_GREY}}[service] [compose-file]\033[0m - List all databases"
|
||||
echo -e " {{CYAN}}{{BOLD}}list-users{{NORMAL}} {{DARK_GREY}}[service] [compose-file]\033[0m - List all users"
|
||||
echo -e " {{CYAN}}{{BOLD}}create-database{{NORMAL}} {{YELLOW}}<database>{{NORMAL}} {{DARK_GREY}}[service] [compose-file]\033[0m - Create database"
|
||||
echo -e " {{CYAN}}{{BOLD}}drop-database{{NORMAL}} {{YELLOW}}<database>{{NORMAL}} {{DARK_GREY}}[service] [compose-file]\033[0m - Drop database (with confirmation)"
|
||||
echo -e " {{CYAN}}{{BOLD}}restore{{NORMAL}} {{YELLOW}}<backup_file>{{NORMAL}} {{DARK_GREY}}[service] [compose-file] [backup_path]\033[0m - Restore from backup"
|
||||
echo ""
|
||||
echo "{{RED}}⚠️ WARNING: drop-database and restore are DESTRUCTIVE operations!{{NORMAL}}"
|
||||
echo ""
|
||||
echo "{{BOLD}}Examples:{{NORMAL}}"
|
||||
echo " just postgres check # Check PostgreSQL status"
|
||||
echo " just postgres sql \"SELECT version();\" # Execute SQL query"
|
||||
echo " just postgres shell # Open interactive shell"
|
||||
echo " just postgres list-databases # List all databases"
|
||||
echo " just postgres create-database mydb # Create new database"
|
||||
echo " just postgres restore backup.sql # Restore from backup"
|
||||
echo ""
|
||||
|
||||
# Execute PostgreSQL SQL query
|
||||
sql query service="postgres" compose-file="":
|
||||
#!/usr/bin/env bash
|
||||
|
||||
@@ -1,5 +1,32 @@
|
||||
# Container registry authentication and management
|
||||
|
||||
alias help := default
|
||||
|
||||
# Default recipe - show available commands
|
||||
[no-cd]
|
||||
[private]
|
||||
default:
|
||||
@echo "{{BOLD}}Registry Management Commands{{NORMAL}}"
|
||||
@echo ""
|
||||
@echo "{{BOLD}}Usage:{{NORMAL}}"
|
||||
@echo " just registry <command>"
|
||||
@echo ""
|
||||
@echo "{{BOLD}}Commands:{{NORMAL}}"
|
||||
@echo " {{CYAN}}{{BOLD}}login{{NORMAL}} - Login to container registry"
|
||||
@echo " {{CYAN}}{{BOLD}}logout{{NORMAL}} - Logout from container registry"
|
||||
@echo " {{CYAN}}{{BOLD}}check{{NORMAL}} - Check registry authentication status"
|
||||
@echo ""
|
||||
@echo "{{BOLD}}Environment Variables:{{NORMAL}}"
|
||||
@echo " GITHUB_USERNAME - Registry username (required for login)"
|
||||
@echo " GITHUB_TOKEN - Registry token/password (required for login)"
|
||||
@echo " REGISTRY - Registry URL (default: ghcr.io)"
|
||||
@echo ""
|
||||
@echo "{{BOLD}}Examples:{{NORMAL}}"
|
||||
@echo " just registry login # Login to registry using env vars"
|
||||
@echo " just registry check # Check authentication status"
|
||||
@echo " just registry logout # Logout from registry"
|
||||
@echo ""
|
||||
|
||||
# Login to container registry
|
||||
login:
|
||||
#!/usr/bin/env bash
|
||||
|
||||
@@ -1,5 +1,40 @@
|
||||
# Universal volume management operations
|
||||
|
||||
# Define custom colors not in Just's native set
|
||||
DARK_GREY := '\033[2m' # Dark grey (dim) for optional parameters
|
||||
|
||||
alias help := default
|
||||
|
||||
# Default recipe - show available commands
|
||||
[no-cd]
|
||||
[private]
|
||||
default:
|
||||
#!/usr/bin/env bash
|
||||
echo "{{BOLD}}Volume Management Commands{{NORMAL}}"
|
||||
echo ""
|
||||
echo "{{BOLD}}Usage:{{NORMAL}}"
|
||||
echo " just volumes <command> [parameters]"
|
||||
echo ""
|
||||
echo "{{BOLD}}Parameters:{{NORMAL}}"
|
||||
echo -e " {{YELLOW}}<required>{{NORMAL}} - Required parameter"
|
||||
echo -e " {{DARK_GREY}}[optional]{{NORMAL}} - Optional parameter"
|
||||
echo ""
|
||||
echo "{{BOLD}}Commands:{{NORMAL}}"
|
||||
echo -e " {{CYAN}}{{BOLD}}list{{NORMAL}} {{DARK_GREY}}[pattern]\033[0m - List all volumes or filter by pattern"
|
||||
echo -e " {{CYAN}}{{BOLD}}remove{{NORMAL}} {{YELLOW}}<volume_name>{{NORMAL}} - Remove specific volume (with confirmation)"
|
||||
echo -e " {{CYAN}}{{BOLD}}remove-pattern{{NORMAL}} {{YELLOW}}<pattern>{{NORMAL}} - Remove volumes matching pattern (with confirmation)"
|
||||
echo -e " {{CYAN}}{{BOLD}}clean-all{{NORMAL}} {{DARK_GREY}}[compose-file]\033[0m - Clean all volumes from compose file (with confirmation)"
|
||||
echo ""
|
||||
echo "{{RED}}⚠️ WARNING: Remove operations are DESTRUCTIVE and will DELETE DATA!{{NORMAL}}"
|
||||
echo ""
|
||||
echo "{{BOLD}}Examples:{{NORMAL}}"
|
||||
echo " just volumes list # List all volumes"
|
||||
echo " just volumes list myproject # Filter volumes by pattern"
|
||||
echo " just volumes remove myproject_db_data # Remove specific volume"
|
||||
echo " just volumes remove-pattern 'myproject_*' # Remove all matching volumes"
|
||||
echo " just volumes clean-all compose.yml # Remove all compose volumes"
|
||||
echo ""
|
||||
|
||||
# Clean all volumes used by compose file (DESTRUCTIVE!)
|
||||
[confirm]
|
||||
clean-all compose-file="":
|
||||
|
||||
Reference in New Issue
Block a user