#!/bin/zsh _DEPENDENCIES+=( pgcli ) _REQUIRED_ENV+=() source ${0:a:h}/common.zsh ##################################################################### _LOGIN_POSTGRES() { local _HOST _NAME _PASS _PORT _USER GET_POSTGRES_LOGIN_ARGS $@ local DATA_DIR="$SCWRYPTS_DATA_PATH/db/$_HOST" [ ! -d $DATA_DIR ] && mkdir -p $DATA_DIR cd $DATA_DIR __STATUS "performing login : $_USER@$_HOST:$_PORT/$_NAME" __STATUS "working directory : $DATA_DIR" PGPASSWORD="$_PASS" pgcli \ --host $_HOST \ --port $_PORT \ --user $_USER \ --dbname $_NAME \ ; } ##################################################################### _LOGIN_POSTGRES $@