Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions dist/bash_completion.d/oscap
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,15 @@ function _oscap {
opts[oscap:info]="--fetch-remote-resources --local-files --profile --profiles --references"

# local variables
local std cmd i prev
local c=1
local cur="`_get_cword`"
local prog="${COMP_WORDS[0]}"
local cur prev words cword split
_init_completion -s || return
local cmd i
local c=1
local modpath='oscap'
_comp__split_longopt || prev="${COMP_WORDS[$COMP_CWORD-1]}"

# get module path
while [ $c -lt $COMP_CWORD ]; do
i="${COMP_WORDS[c]}"
while [ $c -lt $cword ]; do
i="${words[c]}"
case "$i" in
# TODO handle generic switches
-*) _oscap_noarg "$i"; c=$((c + $?)) ;;
Expand All @@ -70,7 +69,12 @@ function _oscap {
--report) _filedir 'html' ;;
esac

elif [ "x${cur:0:1}" == "x-" ]; then
return
fi

$split && return

if [ "x${cur:0:1}" == "x-" ]; then
# an option
COMPREPLY=( $(compgen -W "${opts[$modpath]}" -- ${cur}) )
elif [ "x${cmds[$modpath]}" != 'x' ]; then
Expand Down
Loading