Skip to content

Instantly share code, notes, and snippets.

@calevans
Created May 26, 2021 15:52
Show Gist options
  • Save calevans/054be53905f96dd2299df92c7b005aa3 to your computer and use it in GitHub Desktop.
Save calevans/054be53905f96dd2299df92c7b005aa3 to your computer and use it in GitHub Desktop.
Lando macros I use
# Lando aliases and functions
# Author: Cal Evans
# Copyright 2021 All Rigths Reserved
# License MIT
#
# db
#
# Show what Lando (docker ) DB services are running and what port they are
# running on
#
function db() {
RUNNING=$(docker ps --format "table {{.Names}}__{{.Ports}}\n" | grep 3306)
echo
echo "Lando databases running"
echo "Instance Name : DB Port"
echo "----------------:--------"
for THISONE in $RUNNING
do
INSTANCE=$(echo $THISONE | awk '{print $1}' | awk -F '_' '{print $1}' )
PORT=$(echo $THISONE | awk -F '__' '{print $2}' | awk -F ':' '{print $2}' | awk -F '->' '{print $1}')
printf "%-15s : %s\n" $INSTANCE $PORT
done
echo "";
}
#
# running
# Show the running instances
#
alias running='docker ps --format "{{.Names}}"'
#
# log
# Start logging on the lando instance in the current dir.
#
alias log='lando logs -s appserver -f'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment