From c57069e0afcbfff728ad1c60e9c5f70ce487ca0b Mon Sep 17 00:00:00 2001 From: 3wc <3wc.git@doesthisthing.work> Date: Wed, 18 Nov 2020 00:34:38 +0200 Subject: [PATCH] Use ABRA_DIR instead of hard-coding .abra --- abra | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/abra b/abra index 4a566fe..afd7437 100755 --- a/abra +++ b/abra @@ -1,7 +1,7 @@ #!/usr/bin/env bash GIT_URL="https://git.autonomic.zone/coop-cloud/" -ABRA_DIR="$HOME/.abra" +ABRA_DIR="${ABRA_DIR:-$HOME/.abra}" ####################################### # Global help @@ -348,7 +348,8 @@ load_custom_commands() { get_servers() { shopt -s nullglob dotglob - SERVERS=(~/.abra/servers/*) + # shellcheck disable=SC2206 + SERVERS=($ABRA_DIR/servers/*) shopt -u nullglob dotglob } @@ -370,7 +371,7 @@ get_app_keys() { load_instance() { DOMAIN="$abra__domain_" # FIXME 3wc: requires bash 4, use for loop instead - mapfile -t ENV_FILES < <(find -L ~/.abra -name "$DOMAIN.env") + mapfile -t ENV_FILES < <(find -L "$ABRA_DIR" -name "$DOMAIN.env") case "${#ENV_FILES[@]}" in 1 ) ;; 0 ) error "Can't find app '$DOMAIN'"; return;; @@ -446,7 +447,8 @@ sub_app_ls (){ sub_app_list (){ shopt -s nullglob dotglob - ENV_FILES=(~/.abra/servers/*/*.env) + # shellcheck disable=SC2206 + ENV_FILES=($ABRA_DIR/servers/*/*.env) shopt -u nullglob dotglob STATUS="${abra___status:+STATUS}"