summaryrefslogtreecommitdiff
path: root/plugins/npx/npx.plugin.zsh
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/npx/npx.plugin.zsh')
-rw-r--r--plugins/npx/npx.plugin.zsh17
1 files changed, 11 insertions, 6 deletions
diff --git a/plugins/npx/npx.plugin.zsh b/plugins/npx/npx.plugin.zsh
index 32bb67377..c1e2eca98 100644
--- a/plugins/npx/npx.plugin.zsh
+++ b/plugins/npx/npx.plugin.zsh
@@ -1,7 +1,12 @@
-# NPX Plugin
-# https://www.npmjs.com/package/npx
-# Maintainer: Pooya Parsa <pooya@pi0.ir>
+if (( ! $+commands[npx] )); then
+ return
+fi
-(( $+commands[npx] )) && {
- source <(npx --shell-auto-fallback zsh)
-}
+if ! npx_fallback_script="$(npx --shell-auto-fallback zsh 2>/dev/null)"; then
+ print -u2 ${(%):-"%F{yellow}This \`npx\` version ($(npx --version)) is not supported.%f"}
+else
+ source <(<<< "$npx_fallback_script")
+fi
+
+print -u2 ${(%):-"%F{yellow}The \`npx\` plugin is deprecated and will be removed soon. %BPlease disable it%b.%f"}
+unset npx_fallback_script