From 8dee4e4961e53e6e55f13763a0a101982dff6e11 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Sun, 16 Sep 2018 16:50:19 -0700 Subject: [PATCH 1/2] Fix bash completion on mac. For some bizarro reason, mac's bash doesn't like negative indexes, even though its version of bash should support it. --- src/etc/cargo.bashcomp.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/etc/cargo.bashcomp.sh b/src/etc/cargo.bashcomp.sh index bed72cc80ad..3d8ed1d771b 100644 --- a/src/etc/cargo.bashcomp.sh +++ b/src/etc/cargo.bashcomp.sh @@ -125,7 +125,7 @@ __cargo_commands=$(cargo --list 2>/dev/null | tail -n +2) _locate_manifest(){ local manifest=`cargo locate-project 2>/dev/null` # regexp-replace manifest '\{"root":"|"\}' '' - echo ${manifest:9:-2} + echo ${manifest:9:${#manifest}-11} } # Extracts the values of "name" from the array given in $1 and shows them as From 3ae7f030c98fe9b1de09eee9fceae323d1217f86 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Sun, 16 Sep 2018 16:59:42 -0700 Subject: [PATCH 2/2] Bash completion: support arbitrary toolchain names. --- src/etc/cargo.bashcomp.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/etc/cargo.bashcomp.sh b/src/etc/cargo.bashcomp.sh index 3d8ed1d771b..5bfdd20ba3b 100644 --- a/src/etc/cargo.bashcomp.sh +++ b/src/etc/cargo.bashcomp.sh @@ -238,6 +238,8 @@ _toolchains(){ result+=("+${BASH_REMATCH[1]}-${BASH_REMATCH[3]}") fi result+=("+$line") + else + result+=("+$line") fi done <<< "$toolchains" echo "${result[@]}"