scwrypts/zsh/db/interactive/postgres
yage 89e899d49d v2.1.0
=====================================================================

--- New Scripts --------------------------

zsh )
  database backup/restore
   - db/postgres/pg_dump
   - db/postgres/pg_restore
   - aws/rds/create-backup
   - aws/rds/load-backup

  redis-cached curl commands
   - redis/curl

  youtube download
   - youtube/download
   - youtube/get-audio-clip

--- Changes ------------------------------

- 'scwrypts' executable now reloads upon execution to prevent staleness
- added various options to improve api/cli; see 'scwrypts --help' for more

--- Bug Fixes ----------------------------

- fixed an issue with .config settings' visibility to non-zsh scripts
- fixed an issue with command arguments globbing too early
2022-08-02 00:24:29 -06:00

30 lines
646 B
Bash
Executable File

#!/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 $@