From 790620024e09c6ced12b5634dbeba1eaade5d5f4 Mon Sep 17 00:00:00 2001 From: ERAMOTO Masaya Date: Tue, 22 Jan 2019 19:27:26 +0900 Subject: [PATCH] completions: Fix bash completions when a option requires a argument Since the string of options variable as pattern in the case statement has not been delimited and it does not match the value of prev variable, bash completions tries to complement any option even when a specified option requires a argument. This fix stops complementing options when a option requires a argument. Signed-off-by: ERAMOTO Masaya --- completions/bash/skopeo | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/completions/bash/skopeo b/completions/bash/skopeo index 9e81cd7b..e3012b05 100644 --- a/completions/bash/skopeo +++ b/completions/bash/skopeo @@ -6,11 +6,14 @@ _complete_() { local options_with_args=$1 local boolean_options="$2 -h --help" - case "$prev" in - $options_with_args) - return - ;; - esac + local option_with_args + for option_with_args in $options_with_args + do + if [ "$option_with_args" == "$prev" ] + then + return + fi + done case "$cur" in -*)