#!/bin/bash # # bash_completion for PTXdist by Wolfram Sang, Pengutronix e.K., in 2008-2010 # part of PTXdist, so same licence. # if have ptxdist; then _ptxdist_completion() { local cur cmds opts COMPREPLY=() cur=( $(_get_cword) ) opts=' --collectionconfig --debug --force --force-download --j-extern --j-intern -k --platformconfig --ptxconfig --quiet --toolchain' cmds=' allmodconfig allnoconfig allyesconfig autobuild boardsetup clean clone collection compile distclean drop export_src extract get go images install kernelconfig menu menuconfig migrate newpackage oldconfig platform platformconfig prepare print projects ptxdist select setup tags targetinstall test toolchain u_boot_config version' # if no commands were given, complete on commands themselves 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 barebox board collection user" -- $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 /dummy >/dev/null [ $COMP_CWORD -lt 4 ] && _filedir -d ;; toolchain|export_src) compgen -f /dummy >/dev/null [ $COMP_CWORD -lt 3 ] && _filedir -d ;; select|platform|collection) compgen -f /dummy >/dev/null [ $COMP_CWORD -lt 3 ] && _filedir ;; get|extract|prepare|compile|install|targetinstall|tags) COMPREPLY=( $( compgen -W "${opts} $( ptxdist print PTX_PACKAGES_SELECTED )" -- $cur ) ) ;; clean) COMPREPLY=( $( compgen -W "${opts} $( ptxdist print PTX_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 ) ) ;; newpackage) COMPREPLY=( $( compgen -W "${opts} target host cross klibc src-autoconf-lib src-autoconf-prog src-autoconf-proglib src-cmake-prog src-qmake-prog src-make-prog src-linux-driver src-stellaris font simple kernel image-tgz image-genimage" -- $cur) ) ;; esac return 0 } complete -F _ptxdist_completion ptxdist fi