From f4acb49ea148cdd899f7f29f1591c7bc853c2135 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 4 May 2024 03:03:18 +0200 Subject: Adding upstream version 1:2.12.0. Signed-off-by: Daniel Baumann --- completions/make | 214 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 109 insertions(+), 105 deletions(-) (limited to 'completions/make') diff --git a/completions/make b/completions/make index 96517c2..94e2b73 100644 --- a/completions/make +++ b/completions/make @@ -1,135 +1,128 @@ # bash completion for GNU make -*- shell-script -*- -_make_target_extract_script() +# Extract the valid target names starting with PREFIX from the output of +# `make -npq' +# @param mode If this is `-d', the directory names already specified in +# PREFIX are omitted in the output +# @param prefix Prefix of the target names +_comp_cmd_make__extract_targets() { - local mode="$1" - shift + local mode=$1 + local -x prefix=$2 - local prefix="$1" - local prefix_pat=$(command sed 's/[][\,.*^$(){}?+|/]/\\&/g' <<<"$prefix") - local basename=${prefix##*/} - local dirname_len=$((${#prefix} - ${#basename})) + # display mode, only output current path component to the next slash + local -x prefix_replace=$prefix + [[ $mode == -d && $prefix == */* ]] && + prefix_replace=${prefix##*/} - if [[ $mode == -d ]]; then - # display mode, only output current path component to the next slash - local output="\2" - else - # completion mode, output full path to the next slash - local output="\1\2" - fi - - cat <