Enahnce the docker aliases to all allow logging after the requested action.

This commit is contained in:
2025-06-16 13:59:19 -06:00
parent 7305e3a90c
commit 5f63ad1a59

View File

@ -420,23 +420,63 @@
} }
alias_vim: alias vi=vim alias_vim: alias vi=vim
alias_here: alias here='ls -alh `pwd`/*' alias_here: alias here='ls -alh `pwd`/*'
alias_docker_reload: | function_docker_reload: |
alias docker-reload=' function docker-reload() {
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
cat <<- EOF
Usage: docker-reload [container_name]
Providing the container name starts a log follow after the command.
A reload is characterized by a DOWN, BUILD, and UP.
EOF
return 0
fi
docker compose down && docker compose down &&
docker compose build && docker compose build &&
docker compose up -d docker compose up -d
'
alias_docker_update: | if [[ -n "$1" ]]; then
alias docker-update=' docker logs -f $1
fi
return 0
}
function_docker_update: |
function docker-update() {
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
cat <<- EOF
Usage: docker-update [container_name]
Providing the container name starts a log follow after the command.
An update is characterized by a DOWN, PULL, BUILD, and UP.
EOF
return 0
fi
docker compose down && docker compose down &&
docker compose pull && docker compose pull &&
docker compose build && docker compose build &&
docker compose up -d docker compose up -d
'
if [[ -n "$1" ]]; then
docker logs -f $1
fi
return 0
}
function_docker_upgrade: | function_docker_upgrade: |
function docker-upgrade() { function docker-upgrade() {
# Wrapper for a full-scale upgrade and log view of a container. # Wrapper for a full-scale upgrade and log view of a container.
# Paramaters:
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
cat <<- EOF
Usage: docker-upgrade [container_name]
Providing the container name starts a log follow after the command.
An upgrade is characterized by a DOWN, PULL, BUILD, and UP.
EOF
return 0
fi
# Parameters:
# 1) Container ID or Container Name, as seen in 'docker ps' command. # 1) Container ID or Container Name, as seen in 'docker ps' command.
container=$1 container=$1
if [[ -z $container ]]; then if [[ -z $container ]]; then
@ -466,9 +506,29 @@
echo "*** Following Log ***" && echo "*** Following Log ***" &&
echo "Press ^C to escape." && echo "Press ^C to escape." &&
docker logs -f $container docker logs -f $container
return 0
}
function_docker_restart: |
function docker-restart() {
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
cat <<- EOF
Usage: docker-restart [container_name]
Providing the container name starts a log follow after the command.
A restart is characterized by a DOWN and UP.
EOF
return 0
fi
docker compose down &&
docker compose up -d
if [[ -n "$1" ]]; then
docker logs -f $1
fi
return 0
} }
alias_docker_restart: |
alias docker-restart='docker compose down && docker compose up -d'
alias_code_check: | alias_code_check: |
alias code-check=' alias code-check='
echo "Checking ~/Code directory for git changes." echo "Checking ~/Code directory for git changes."
@ -703,10 +763,10 @@
{{ function_flatpak_purge }} {{ function_flatpak_purge }}
{{ alias_vim }} {{ alias_vim }}
{{ alias_here }} {{ alias_here }}
{{ alias_docker_reload }} {{ function_docker_reload }}
{{ alias_docker_update }} {{ function_docker_update }}
{{ function_docker_upgrade }} {{ function_docker_upgrade }}
{{ alias_docker_restart }} {{ function_docker_restart }}
{{ alias_code_check }} {{ alias_code_check }}
{{ alias_code_reset }} {{ alias_code_reset }}
{{ function_code_reseed }} {{ function_code_reseed }}