Skip to content

Commit 708ff29

Browse files
authored
Merge pull request #2311 from jan-cerny/RHEL-145121
Use stable _init_completion API in bash completion
2 parents 4c34b12 + 4c0e72a commit 708ff29

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

  • dist/bash_completion.d

dist/bash_completion.d/oscap

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,15 @@ function _oscap {
4242
opts[oscap:info]="--fetch-remote-resources --local-files --profile --profiles --references"
4343

4444
# local variables
45-
local std cmd i prev
46-
local c=1
47-
local cur="`_get_cword`"
48-
local prog="${COMP_WORDS[0]}"
45+
local cur prev words cword split
46+
_init_completion -s || return
47+
local cmd i
48+
local c=1
4949
local modpath='oscap'
50-
_comp__split_longopt || prev="${COMP_WORDS[$COMP_CWORD-1]}"
5150

5251
# get module path
53-
while [ $c -lt $COMP_CWORD ]; do
54-
i="${COMP_WORDS[c]}"
52+
while [ $c -lt $cword ]; do
53+
i="${words[c]}"
5554
case "$i" in
5655
# TODO handle generic switches
5756
-*) _oscap_noarg "$i"; c=$((c + $?)) ;;
@@ -70,7 +69,12 @@ function _oscap {
7069
--report) _filedir 'html' ;;
7170
esac
7271

73-
elif [ "x${cur:0:1}" == "x-" ]; then
72+
return
73+
fi
74+
75+
$split && return
76+
77+
if [ "x${cur:0:1}" == "x-" ]; then
7478
# an option
7579
COMPREPLY=( $(compgen -W "${opts[$modpath]}" -- ${cur}) )
7680
elif [ "x${cmds[$modpath]}" != 'x' ]; then

0 commit comments

Comments
 (0)