1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-11-05 06:49:03 -08:00

do the private-or-subshell dance for maybesudo

This commit is contained in:
Connor Olding 2024-03-21 14:36:41 -07:00
parent b5c5ebfded
commit bdd25226a8
2 changed files with 5 additions and 4 deletions

View file

@ -4,7 +4,7 @@
# YES_DASH
# YES_ASH
maybesudo_() ( ### @-
__maybesudo() { ### @maybesudo
### mimic certain features of `sudo` for systems without it installed.
### as it stands, this mostly just handles some environment variables.
###
@ -113,6 +113,7 @@ maybesudo_() ( ### @-
fi
env "$@"
)
}
[ -n "${preload+-}" ] || maybesudo_ "$@"
maybesudo_()(__maybesudo "$@")
[ -n "${preload+-}" ] || __maybesudo "$@"

View file

@ -7,7 +7,7 @@
pippy() { ### @-
### install Python packages using pip,
### but only update their dependencies as required.
### this uses [`maybesudo`](#maybesudo_-shmaybesudo) internally.
### this uses [`maybesudo`](#maybesudo) internally.
if [ -s ~/work/automamba ]; then
~/work/automamba --pip install --upgrade --upgrade-strategy only-if-needed --dry-run "$@"
confirm || return