Skip to content

Instantly share code, notes, and snippets.

@krymen
Created November 21, 2012 11:16
Show Gist options
  • Save krymen/4124392 to your computer and use it in GitHub Desktop.
Save krymen/4124392 to your computer and use it in GitHub Desktop.
Phing bash completion
# /etc/bash_completion.d/phing
_phing () {
local cur prev
COMPREPLY=()
buildfile=build.xml
_get_comp_words_by_ref cur prev
[ ! -f $buildfile ] && return 0
COMPREPLY=( $( compgen -W "$( cat $buildfile | tr "'\t\n>" "\" \n" | \
sed -ne 's/.*<target .*name="\([^"]*\).*/\1/p' 2>/dev/null )" \
-- "$cur" ) )
}
complete -F _phing phing
@Destroy666x
Copy link

Thanks, used it as a basis for https://tech.boldare.com/how-to-write-a-phing-target-autocomplete-bash-script/ if someone wants to also go through imported files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment