From 696bc7532818c91f711387aeeba3293a8d5f495a Mon Sep 17 00:00:00 2001 From: m4rc3l05 Date: Mon, 12 Apr 2021 13:53:10 +0100 Subject: [PATCH 1/2] Fix instalation process on msys2/mingw Signed-off-by: m4rc3l05 --- functions/nvm.fish | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/functions/nvm.fish b/functions/nvm.fish index e81fa1d..33187d1 100644 --- a/functions/nvm.fish +++ b/functions/nvm.fish @@ -49,7 +49,7 @@ function nvm --argument-names cmd v --description "Node version manager" case sunos case linux case darwin - case {MSYS_NT,MINGW\*_NT}\* + case {msys_nt,mingw\*_nt}\* set os win set ext zip case \* @@ -76,13 +76,22 @@ function nvm --argument-names cmd v --description "Node version manager" set --local dir "node-$v-$os-$arch" set --local url $nvm_mirror/$v/$dir.$ext + test "$os" = win && set --local tmp_exe $TMP/(command date +"%s")-$dir.$ext command mkdir -p $nvm_data/$v echo -e "Installing Node \x1b[1m$v\x1b[22m $alias" echo -e "Fetching \x1b[4m$url\x1b[24m\x1b[7m" + if test "$os" = win + if ! command curl --progress-bar --location $url -o $tmp_exe + command rm -rf $nvm_data/$v + echo -e "\033[F\33[2K\x1b[0mnvm: Invalid mirror or host unavailable: \"$url\"" >&2 + return 1 + end - if ! command curl --progress-bar --location $url \ + command unzip -qq -o -d $nvm_data/$v $tmp_exe + rm -rf $tmp_exe + else if ! command curl --progress-bar --location $url \ | command tar --extract --gzip --directory $nvm_data/$v 2>/dev/null command rm -rf $nvm_data/$v echo -e "\033[F\33[2K\x1b[0mnvm: Invalid mirror or host unavailable: \"$url\"" >&2 From f0cd4c1cd37f00fc599412965b1b33f94753594f Mon Sep 17 00:00:00 2001 From: m4rc3l05 Date: Mon, 12 Apr 2021 13:53:55 +0100 Subject: [PATCH 2/2] Add installation notes for msys2/mingw users Signed-off-by: m4rc3l05 --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 93bf169..99df725 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,8 @@ Install with [Fisher](https://github.com/jorgebucaran/fisher): fisher install jorgebucaran/nvm.fish ``` +> **msys2/mingw** users will need to install unzip if not already installed. + ## Quickstart Install the latest Node release and activate it.