From 92cf6a1f622f6ca54302efa614b67ab90777662a Mon Sep 17 00:00:00 2001 From: Alejandro R Mosteo Date: Mon, 11 May 2020 16:39:27 +0200 Subject: [PATCH] Suggest valid dependencies after `alr with --del` (#395) --- scripts/alr-completion.bash | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/alr-completion.bash b/scripts/alr-completion.bash index d6e2dd2d..c9aae839 100755 --- a/scripts/alr-completion.bash +++ b/scripts/alr-completion.bash @@ -62,8 +62,10 @@ function _alr_completion() { ;; with) - # Only when the previous word is actually "with": + # When the previous word is "with", show any crate: [ "$prev" == "with" ] && COMPREPLY+=($(compgen -W "$(alr list | cut -f1 -d' ')" -- $curr)) + # When the previous word is "--del", show direct dependencies: + [ "$prev" == "--del" ] && COMPREPLY+=($(compgen -W "$(alr with | tail +2 | grep -Eo -- '[_a-z0-9]+')" -- $curr)) ;; esac } -- 2.39.5