From f2621414ee5f2f601424c22f00e207903e3b6104 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 4 May 2024 03:03:18 +0200 Subject: Merging upstream version 1:2.12.0. Signed-off-by: Daniel Baumann --- completions/ant | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) (limited to 'completions/ant') diff --git a/completions/ant b/completions/ant index 197c0e9..e4f9f29 100644 --- a/completions/ant +++ b/completions/ant @@ -1,6 +1,6 @@ # bash completion for ant and phing -*- shell-script -*- -_ant_parse_targets() +_comp_cmd_ant__targets() { local line basedir @@ -9,9 +9,9 @@ _ant_parse_targets() # parse buildfile for targets while read -rd '>' line; do if [[ $line =~ \<(target|extension-point)[[:space:]].*name=[\"\']([^\"\']+) ]]; then - targets+=" ${BASH_REMATCH[2]}" + REPLY+=("${BASH_REMATCH[2]}") fi - done <$1 + done <"$1" # parse imports while read -rd '>' line; do @@ -19,39 +19,39 @@ _ant_parse_targets() local imported_buildfile imported_buildfile="${basedir}/${BASH_REMATCH[1]}" if [[ -f $imported_buildfile ]]; then - _ant_parse_targets $imported_buildfile + "$FUNCNAME" "$imported_buildfile" fi fi - done <$1 + done <"$1" } -_ant() +_comp_cmd_ant() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return case $prev in -h | -help | --h | --help | -projecthelp | -p | -version | -diagnostics) return ;; -buildfile | -file | -f) - _filedir 'xml' + _comp_compgen_filedir 'xml' return ;; -logfile | -l) - [[ $1 != *phing || $prev != -l ]] && _filedir + [[ $1 != *phing || $prev != -l ]] && _comp_compgen_filedir return ;; -propertyfile) - _filedir properties + _comp_compgen_filedir properties return ;; -nice) - COMPREPLY=($(compgen -W '{1..10}' -- "$cur")) + _comp_compgen -- -W '{1..10}' return ;; -lib) - _filedir -d + _comp_compgen_filedir -d return ;; -logger | -listener | -inputhandler | -main | -find | -s) @@ -64,8 +64,7 @@ _ant() elif [[ $cur == -* ]]; then # The /dev/null && - complete -C complete-ant-cmd.pl -F _ant ant || : + complete -F _comp_cmd_ant ant phing +if type complete-ant-cmd.pl &>/dev/null; then + complete -C complete-ant-cmd.pl -F _comp_cmd_ant ant +fi # ex: filetype=sh -- cgit v1.2.3