Skip to content
Snippets Groups Projects
Commit 6d649ddf authored by Mark OLESEN's avatar Mark OLESEN
Browse files

STYLE: prefix bash completion functions with '_of_' for easier removal

parent 685d6a0e
Branches
Tags
No related merge requests found
...@@ -82,8 +82,8 @@ touch $outFile ...@@ -82,8 +82,8 @@ touch $outFile
writeFilterFunction() writeFilterFunction()
{ {
cat<< WRITEFILTER >> $1 cat<< WRITEFILTER >> $1
unset -f _filter_opts 2>/dev/null unset -f _of_filter_opts 2>/dev/null
_filter_opts() _of_filter_opts()
{ {
local allOpts=\$1 local allOpts=\$1
local applied=\$2 local applied=\$2
...@@ -166,8 +166,8 @@ do ...@@ -166,8 +166,8 @@ do
opts=($(awk '/^ {0,4}-[a-z]/ && !/</ {print $1}' <<< "$appHelp")) opts=($(awk '/^ {0,4}-[a-z]/ && !/</ {print $1}' <<< "$appHelp"))
cat<<WRITECOMPLETION >> $outFile cat<<WRITECOMPLETION >> $outFile
unset -f _${appName} 2>/dev/null unset -f _of_${appName} 2>/dev/null
_${appName}() _of_${appName}()
{ {
local cur="\${COMP_WORDS[COMP_CWORD]}" local cur="\${COMP_WORDS[COMP_CWORD]}"
local prev="\${COMP_WORDS[COMP_CWORD-1]}" local prev="\${COMP_WORDS[COMP_CWORD-1]}"
...@@ -185,8 +185,8 @@ $(commonOptions ${optsWithArgs[@]}) ...@@ -185,8 +185,8 @@ $(commonOptions ${optsWithArgs[@]})
COMPREPLY=(\$(compgen -f -- \${cur})) COMPREPLY=(\$(compgen -f -- \${cur}))
else else
# Catch-all - present all remaining options # Catch-all - present all remaining options
opts=\$(_filter_opts "\${opts}" "\${COMP_LINE}") opts=\$(_of_filter_opts "\${opts}" "\${COMP_LINE}")
optsWithArgs=\$(_filter_opts "\${optsWithArgs}" "\${COMP_LINE}") optsWithArgs=\$(_of_filter_opts "\${optsWithArgs}" "\${COMP_LINE}")
COMPREPLY=(\$(compgen -W "\${opts} \${optsWithArgs}" -- \${cur})) COMPREPLY=(\$(compgen -W "\${opts} \${optsWithArgs}" -- \${cur}))
fi fi
;; ;;
...@@ -194,7 +194,7 @@ $(commonOptions ${optsWithArgs[@]}) ...@@ -194,7 +194,7 @@ $(commonOptions ${optsWithArgs[@]})
return 0 return 0
} }
complete -o nospace -F _${appName} $appName complete -o nospace -F _of_${appName} $appName
WRITECOMPLETION WRITECOMPLETION
done done
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment