Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _reply_compgen_array()
- {
- # Create the argument for compgen -W by escaping twice.
- #
- # One round of escape is because we want to reply with escaped arguments. A
- # second round is required because compgen -W will helpfully expand it's
- # argument.
- local i wlist
- echo ${COMPREPLY}
- for i in ${!COMPREPLY[*]}; do
- local q=$(quote "$(printf %q "${COMPREPLY[$i]}")")
- wlist+=$q$'\n'
- done
- # We also have to add another round of escaping to $cur.
- local ecur="$cur"
- ecur="${ecur//\\/\\\\}"
- ecur="${ecur//\'/\'}"
- # Actually generate completions.
- local oldifs=$IFS
- IFS=$'\n' eval 'COMPREPLY=(`compgen -W "$wlist" -- "${ecur}"`)'
- IFS=$oldifs
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement