Skip to content

Commit

Permalink
only sync if not found
Browse files Browse the repository at this point in the history
  • Loading branch information
mxcl committed Oct 23, 2023
1 parent 346307d commit 69ccf8c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/modes/shellcode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default function() {
if type _pkgx_reset >/dev/null 2>&1; then
_pkgx_reset
fi
unset -f _pkgx_chpwd_hook _pkgx_should_deactivate_devenv pkgx x command_not_found_handler command_not_found_handle pkgx@latest _pkgx_commit _pkgx_dev_off >/dev/null 2>&1
unset -f _pkgx_chpwd_hook _pkgx_should_deactivate_devenv pkgx x command_not_found_handler command_not_found_handle pkgx@latest _pkgx_commit _pkgx_dev_off _pkgx_provider >/dev/null 2>&1
echo "pkgx: shellcode unloaded" >&2;;
*)
command pkgx "$@";;
Expand Down Expand Up @@ -99,11 +99,17 @@ export default function() {
fi
}
_pkgx_provider() {
if ! command pkgx --silent --provider "$1"; then
command pkgx --sync --keep-going --silent --provider "$1"
fi
}
command_not_found_handler() {
if [ "$1" = pkgx ]; then
if [ $1 = pkgx ]; then
echo 'fatal: \`pkgx\` not in PATH' >&2
return 1
elif [ -t 2 ] && command pkgx --sync --keep-going --silent --provider "$1"; then
elif [ -t 2 ] && _pkgx_provider $1; then
echo -e '${dim('^^ type `')}x${dim('` to run that')}' >&2
d="${tmp}/shellcode"
Expand Down

0 comments on commit 69ccf8c

Please sign in to comment.