From b9b6e44f98bbb744824190439f383460d7f86abd Mon Sep 17 00:00:00 2001 From: crater2150 Date: Mon, 4 Sep 2023 10:04:08 +0200 Subject: [PATCH] import-env: allow specifying fallback names --- import-env.zsh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/import-env.zsh b/import-env.zsh index 83d6bee..f6a2662 100644 --- a/import-env.zsh +++ b/import-env.zsh @@ -1,7 +1,10 @@ import-env() { - SOURCE_PROCESS=$1 - SOURCE_PID=$(pgrep $SOURCE_PROCESS | head -n 1) + for source_name in $@; do + SOURCE_PID=$(pgrep $source_name | head -n 1) + if [[ -n $SOURCE_PID ]]; then break; fi + done if [[ -z $SOURCE_PID ]]; then return 1; fi + SOURCE_ENV=("${(@ps:\000:)$(