From 3fbd9768e8eff5cf3561b2758e41a85e9f44c195 Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Mon, 17 Nov 2008 22:41:43 +0000 Subject: * bash_completion: first shot, won't be installed yet. (cp scripts/bash_completion /etc/bash_completion.d/ptxdist) git-svn-id: https://svn.pengutronix.de/svn/ptxdist/trunks/ptxdist-trunk@9127 33e552b5-05e3-0310-8538-816dae2090ed --- scripts/bash_completion | 55 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 scripts/bash_completion (limited to 'scripts/bash_completion') diff --git a/scripts/bash_completion b/scripts/bash_completion new file mode 100644 index 000000000..47812b98f --- /dev/null +++ b/scripts/bash_completion @@ -0,0 +1,55 @@ +# bash_completion for PTXdist by Wolfram Sang, Pengutronix e.K., in 2008 +# part of PTXdist, so same licence. + +if have ptxdist; then + +_ptxdist_completion() +{ + local cur cmds opts + + COMPREPLY=() + cur=( $(_get_cword) ) + + opts=' --debug --force --j-extern --j-intern --platformconfig --ptxconfig --quiet --toolchain' + cmds=' autobuild boardsetup clean clone compile distclean drop export_src extract get go images install kernelconfig menu menuconfig newpacket oldconfig platform platformconfig prepare print projects ptxdist select setup tags targetinstall test toolchain u_boot_config version' + + # if no command were given, complete on commands + if [ $COMP_CWORD -eq 1 ]; then + COMPREPLY=( $( compgen -W "${cmds} help" -- $cur ) ) + return 0 + fi + + # Complete depending on options + case ${COMP_WORDS[1]} in + menuconfig) + COMPREPLY=( $( compgen -W "${opts} kernel platform u-boot-v2" -- $cur) ) + ;; + clone) + #HACK! Enable filename completion without specifying '-o filenames' during complete (that will add slashes to commands if there is a dir of the same name :( ) + compgen -f >/dev/null + [ $COMP_CWORD -lt 4 ] && _filedir -d + ;; + select|platform|toolchain|export_src) + compgen -f >/dev/null + [ $COMP_CWORD -lt 3 ] && _filedir -d + ;; + get|extract|prepare|compile|install|targetinstall|tags) + COMPREPLY=( $( compgen -W "${opts} $( ptxdist print PACKAGES_SELECTED )" -- $cur ) ) + ;; + clean) + COMPREPLY=( $( compgen -W "${opts} $( ptxdist print PACKAGES_SELECTED ) root" -- $cur ) ) + ;; + drop) + COMPREPLY=( $( compgen -W "${opts} $( pushd $(ptxdist print PTXDIST_PLATFORMDIR)/state >/dev/null; ls +(*.get|*.extract|*.prepare|*.compile|*.install|*.targetinstall); popd >/dev/null )" -- $cur ) ) + ;; + newpacket) + COMPREPLY=( $( compgen -W "${opts} target host host-existing-target cross cross-existing-target source kernel-driver font simple" -- $cur) ) + ;; + esac + return 0 +} + +complete -F _ptxdist_completion ptxdist + +fi + -- cgit v1.2.3