From 7652c45609757b7aa5541dc0ae156333366d5cd4 Mon Sep 17 00:00:00 2001 From: Anton Bobov Date: Thu, 8 Feb 2024 19:38:12 +0500 Subject: [eget] Add local eget config --- files/.zsh/rc/S20_eget | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'files/.zsh') diff --git a/files/.zsh/rc/S20_eget b/files/.zsh/rc/S20_eget index 0a0aa26..cdd9713 100644 --- a/files/.zsh/rc/S20_eget +++ b/files/.zsh/rc/S20_eget @@ -1,5 +1,20 @@ function () { __EGET_LOCATION="$HOME/.local/bin/eget" + __EGET_CONFIG="$HOME/.eget.toml" + __EGET_CONFIG_LOCAL="$HOME/.eget.local.toml" + + if [ -x "$__EGET_LOCATION" ] ; then + function eget() { + config="$__EGET_CONFIG" + if [ -f "$__EGET_CONFIG_LOCAL" ] ; then + config=$(mktemp -t eget.config.XXXXX --suffix .toml) + trap "rm '$config'" EXIT + cat "$__EGET_CONFIG" "$__EGET_CONFIG_LOCAL" >"$config" 2>/dev/null + fi + + (export EGET_CONFIG="$config" && "$__EGET_LOCATION" "$@") + } + fi if [ ! -x "$__EGET_LOCATION" ] ; then function eget() { -- cgit v1.2.3