]> Sergey Matveev's repositories - nnn.git/commitdiff
getplugs: add "master" version support (#560)
authorlvgx <l@vgx.fr>
Wed, 6 May 2020 17:06:19 +0000 (19:06 +0200)
committerGitHub <noreply@github.com>
Wed, 6 May 2020 17:06:19 +0000 (22:36 +0530)
Pass "master" as first argument to the script.

plugins/getplugs

index 0c68be07579eadc85e8ce4a493169f081c7fe7d7..d8750746bc5faeb3f22122156613329bf26d021f 100755 (executable)
@@ -43,8 +43,12 @@ prompt () {
 #     sucmd=: # noop
 # fi
 
-if which nnn >/dev/null 2>&1; then
+if [ "$1" = "master" ] ; then
+    VER="master"
+    ARCHIVE_URL=https://github.com/jarun/nnn/archive/master.tar.gz
+elif which nnn >/dev/null 2>&1; then
     VER=$(nnn -V)
+    ARCHIVE_URL=https://github.com/jarun/nnn/releases/download/v"$VER"/nnn-v"$VER".tar.gz
 else
     echo "nnn is not installed"
     exit 1
@@ -57,8 +61,8 @@ fi
 
 mkdir -p "$PLUGIN_DIR"
 cd "$CONFIG_DIR" || exit 1
-curl -Ls -O https://github.com/jarun/nnn/releases/download/v"$VER"/nnn-v"$VER".tar.gz
-tar -zxf nnn-v"$VER".tar.gz
+curl -Ls "$ARCHIVE_URL" -o nnn-"$VER".tar.gz
+tar -zxf nnn-"$VER".tar.gz
 
 cd nnn-"$VER"/plugins || exit 1
 
@@ -76,4 +80,4 @@ for f in $(find . -maxdepth 1 \( ! -iname "." ! -iname "*.md" \)); do
 done
 cd ../.. || exit 1
 
-rm -rf nnn-"$VER"/ nnn-v"$VER".tar.gz
+rm -rf nnn-"$VER"/ nnn-"$VER".tar.gz