fix local name WEBI_CSV
[webi-installers/.git] / rg / rg.bash
index 51c3e598a5f12944103958e31a546fa319e52c32..7c2a825b34aa887ef14b723b791970b3bc5beb2f 100644 (file)
@@ -3,7 +3,7 @@
 # tagline: a modern drop-in grep replacement
 # alias: rg
 # description: |
-#   'rg' is a drop-in replacement for 'grep', that respects '.gitignore' and '.ignore', has all of the sensible default options you want (colors, numbers, etc) turned on by default, is written in Rust, and simply outperforms grep in every imaginable way. R.I.P. grep.
+#   `rg` is a drop-in replacement for `grep`, that respects `.gitignore` and `.ignore`, has all of the sensible default options you want (colors, numbers, etc) turned on by default, is written in Rust, and simply outperforms grep in every imaginable way. R.I.P. grep.
 # examples: |
 #
 #   ```bash
@@ -20,7 +20,6 @@
 
 set -e
 set -u
-set -o pipefail
 
 # Use the script's first argument or the supplied WEBI_VERSION or ''
 WEBI_VERSION=${1:-${WEBI_VERSION:-}}
@@ -35,16 +34,16 @@ WEBI_TMP=${WEBI_TMP:-"$(mktemp -d -t webinstall-ripgrep.XXXXXXXX)"}
 # The WEBI bootstrap will define these
 # but each script should be testable in its own right
 
-if [ -z "${WEBI_PKG_URL}" ]; then
+if [ -z "${WEBI_PKG_URL:-}" ]; then
   release_tab="${WEBI_HOST}/api/releases/ripgrep@${WEBI_VERSION:-}.csv?os=$(uname -s)&arch=$(uname -m)&ext=tar&limit=1"
   WEBI_CSV=$(curl -fsSL "$release_tab" -H "User-Agent: $(uname -a)")
-  WEBI_CHANNEL=$(echo $WEBI_TAB | cut -d ',' -f 3)
+  WEBI_CHANNEL=$(echo $WEBI_CSV | cut -d ',' -f 3)
   if [ "error" == "$WEBI_CHANNEL" ]; then
      echo "could not find release for ripgrep v${WEBI_VERSION}"
      exit 1
   fi
-  WEBI_VERSION=$(echo $WEBI_TAB | cut -d ',' -f 1)
-  WEBI_PKG_URL=$(echo $WEBI_TAB | cut -d ',' -f 9)
+  WEBI_VERSION=$(echo $WEBI_CSV | cut -d ',' -f 1)
+  WEBI_PKG_URL=$(echo $WEBI_CSV | cut -d ',' -f 9)
   WEBI_PKG_FILE="$WEBI_TMP/$(echo $WEBI_PKG_URL | sed s:.*/::)"
 fi