envwrap: create new wrapper if called directly
This commit is contained in:
parent
9816ddd536
commit
7370e1898f
1 changed files with 6 additions and 0 deletions
|
|
@ -1,6 +1,12 @@
|
||||||
#!/bin/zsh
|
#!/bin/zsh
|
||||||
source ${$(realpath "$0"):h:h}/lib/next-in-path.zsh
|
source ${$(realpath "$0"):h:h}/lib/next-in-path.zsh
|
||||||
program="${0:a:t}"
|
program="${0:a:t}"
|
||||||
|
if [[ $program == "envwrap" ]]; then
|
||||||
|
echo "Creating wrapper for $1 at ${0:a:h}/$1" >&2
|
||||||
|
ln -sr $(realpath "$0") ${0:a:h}/$1
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
envwrapconf=${XDG_CONFIG_HOME:-$HOME/.config}/envwrap/$program
|
envwrapconf=${XDG_CONFIG_HOME:-$HOME/.config}/envwrap/$program
|
||||||
[[ -e $envwrapconf ]] && source $envwrapconf
|
[[ -e $envwrapconf ]] && source $envwrapconf
|
||||||
$(next-in-path "$program" $0) "$@"
|
$(next-in-path "$program" $0) "$@"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue