summaryrefslogtreecommitdiffstats
path: root/completions/lintian
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:03:18 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:03:18 +0000
commitf2621414ee5f2f601424c22f00e207903e3b6104 (patch)
tree56a856dafd1ca684bb23263cacaa723ee4f404fc /completions/lintian
parentAdding debian version 1:2.11-8. (diff)
downloadbash-completion-f2621414ee5f2f601424c22f00e207903e3b6104.tar.xz
bash-completion-f2621414ee5f2f601424c22f00e207903e3b6104.zip
Merging upstream version 1:2.12.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'completions/lintian')
-rw-r--r--completions/lintian119
1 files changed, 63 insertions, 56 deletions
diff --git a/completions/lintian b/completions/lintian
index 9343832..51402b2 100644
--- a/completions/lintian
+++ b/completions/lintian
@@ -1,74 +1,73 @@
# bash completion for lintian(1) and lintian-info(1) -*- shell-script -*-
-_lintian_tags()
+_comp_cmd_lintian__tags()
{
- local match search tags
+ local search tags check_files
+ _comp_expand_glob check_files '/usr/share/lintian/checks/*.desc' || return 0
- tags=$(awk '/^Tag/ { print $2 }' /usr/share/lintian/checks/*.desc)
+ tags=$(_comp_awk '/^Tag/ { print $2 }' "${check_files[@]}")
if [[ $cur == *, ]]; then
search=${cur//,/ }
for item in $search; do
- match=$(command grep -nE "^Tag: $item$" \
- /usr/share/lintian/checks/*.desc | cut -d: -f1)
- tags=$(command sed -e "s/\<$item\>//g" <<<$tags)
+ tags=$(command sed -e "s/\<$item\>//g" <<<"$tags")
done
- COMPREPLY+=($(compgen -W "$tags"))
+ _comp_compgen -aR -- -W "$tags"
elif [[ $cur == *,* ]]; then
- COMPREPLY+=($(compgen -P "${cur%,*}," -W "$tags" -- "${cur##*,}"))
+ _comp_compgen -ac "${cur##*,}" -- -P "${cur%,*}," -W "$tags"
else
- COMPREPLY+=($(compgen -W "$tags" -- "$cur"))
+ _comp_compgen -a -- -W "$tags"
fi
}
-_lintian_checks()
+_comp_cmd_lintian__checks()
{
- local match search todisable checks
+ local match search todisable checks check_files
+ _comp_expand_glob check_files '/usr/share/lintian/checks/*.desc' || return 0
- checks=$(awk '/^(Check-Script|Abbrev)/ { print $2 }' \
- /usr/share/lintian/checks/*.desc)
+ checks=$(_comp_awk '/^(Check-Script|Abbrev)/ { print $2 }' \
+ "${check_files[@]}")
if [[ $cur == *, ]]; then
search=${cur//,/ }
for item in $search; do
match=$(command grep -nE "^(Check-Script|Abbrev): $item$" \
- /usr/share/lintian/checks/*.desc | cut -d: -f1)
- todisable=$(awk '/^(Check-Script|Abbrev)/ { print $2 }' $match)
+ "${check_files[@]}" | cut -d: -f1)
+ todisable=$(_comp_awk '/^(Check-Script|Abbrev)/ { print $2 }' "$match")
for name in $todisable; do
- checks=$(command sed -e "s/\<$name\>//g" <<<$checks)
+ checks=$(command sed -e "s/\<$name\>//g" <<<"$checks")
done
done
- COMPREPLY+=($(compgen -W "$checks"))
+ _comp_compgen -aR -- -W "$checks"
elif [[ $cur == *,* ]]; then
- COMPREPLY+=($(compgen -P "${cur%,*}," -W "$checks" -- "${cur##*,}"))
+ _comp_compgen -ac "${cur##*,}" -- -P "${cur%,*}," -W "$checks"
else
- COMPREPLY+=($(compgen -W "$checks" -- "$cur"))
+ _comp_compgen -a -- -W "$checks"
fi
}
-_lintian_infos()
+_comp_cmd_lintian__infos()
{
- local match search infos
+ local search infos collection_files
+ _comp_expand_glob collection_files '/usr/share/lintian/collection/*.desc' || return 0
- infos=$(awk '/^Collector/ { print $2 }' \
- /usr/share/lintian/collection/*.desc)
+ infos=$(_comp_awk '/^Collector/ { print $2 }' \
+ "${collection_files[@]}")
if [[ $cur == *, ]]; then
search=${cur//,/ }
for item in $search; do
- match=$(command grep -nE "^Collector: $item$" \
- /usr/share/lintian/collection/*.desc | cut -d: -f1)
- infos=$(command sed -e "s/\<$item\>//g" <<<$infos)
+ infos=$(command sed -e "s/\<$item\>//g" <<<"$infos")
done
- COMPREPLY+=($(compgen -W "$infos"))
+ _comp_compgen -aR -- -W "$infos"
elif [[ $cur == *,* ]]; then
- COMPREPLY+=($(compgen -P "${cur%,*}," -W "$infos" -- "${cur##*,}"))
+ _comp_compgen -ac "${cur##*,}" -- -P "${cur%,*}," -W "$infos"
else
- COMPREPLY+=($(compgen -W "$infos" -- "$cur"))
+ _comp_compgen -a -- -W "$infos"
fi
}
-_lintian()
+_comp_cmd_lintian()
{
- local cur prev words cword
- _init_completion || return
+ local cur prev words cword comp_args
+ _comp_initialize -- "$@" || return
local lint_actions general_opts behaviour_opts configuration_opts
@@ -86,36 +85,44 @@ _lintian()
if [[ $prev == -* ]]; then
case $prev in
-C | --check-part | -X | --dont-check-part)
- _lintian_checks
+ _comp_cmd_lintian__checks
+ return
;;
-T | --tags | --suppress-tags)
- _lintian_tags
+ _comp_cmd_lintian__tags
+ return
;;
--tags-from-file | --suppress-tags-from-file | --cfg | -p | \
--packages-file)
- _filedir
+ _comp_compgen_filedir
+ return
;;
--lab | --archivedir | --dist | --root)
- _filedir -d
+ _comp_compgen_filedir -d
+ return
;;
--color)
- COMPREPLY=($(compgen -W "never always auto html" -- "$cur"))
+ _comp_compgen -- -W "never always auto html"
+ return
;;
-U | --unpack-info)
- _lintian_infos
+ _comp_cmd_lintian__infos
+ return
;;
--area | --section)
- COMPREPLY=($(compgen -W "main contrib non-free" -- "$cur"))
+ _comp_compgen -- -W "main contrib non-free"
+ return
+ ;;
+ --arch)
+ return
;;
- --arch) ;;
-
esac
fi
case "$cur" in
--*)
- COMPREPLY=($(compgen -W "$lint_actions $general_opts
- $behaviour_opts $configuration_opts" -- "$cur"))
+ _comp_compgen -- -W "$lint_actions $general_opts $behaviour_opts
+ $configuration_opts"
;;
*,)
# If we're here, the user is trying to complete on
@@ -123,54 +130,54 @@ _lintian()
# Only few actions permit that, re-complete them now.
case "$prev" in
-C | --check-part | -X | --dont-check-part)
- _lintian_checks
+ _comp_cmd_lintian__checks
;;
-T | --tags | --suppress-tags)
- _lintian_tags
+ _comp_cmd_lintian__tags
;;
-U | --unpack-info)
- _lintian_infos
+ _comp_cmd_lintian__infos
;;
esac
;;
*)
# in Ubuntu, dbgsym packages end in .ddeb, lintian >= 2.57.0 groks
- _filedir '@(?(u|d)deb|changes|dsc|buildinfo)'
+ _comp_compgen_filedir '@(?(u|d)deb|changes|dsc|buildinfo)'
;;
esac
return 0
} &&
- complete -F _lintian lintian
+ complete -F _comp_cmd_lintian lintian
-_lintian_info()
+_comp_cmd_lintian_info()
{
- local cur prev words cword
- _init_completion || return
+ local cur prev words cword comp_args
+ _comp_initialize -- "$@" || return
case "$prev" in
--help | --profile)
return
;;
-t | --tags)
- _lintian_tags
+ _comp_cmd_lintian__tags
return
;;
--include-dir)
- _filedir -d
+ _comp_compgen_filedir -d
return
;;
esac
case "$cur" in
--*)
- COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur"))
+ _comp_compgen_help
;;
*)
- _filedir
+ _comp_compgen_filedir
;;
esac
return 0
} &&
- complete -F _lintian_info lintian-info
+ complete -F _comp_cmd_lintian_info lintian-info
# ex: filetype=sh