summaryrefslogtreecommitdiffstats
path: root/scripts/bash_completion
diff options
context:
space:
mode:
authorWolfram Sang <w.sang@pengutronix.de>2008-11-17 22:41:43 +0000
committerWolfram Sang <w.sang@pengutronix.de>2008-11-17 22:41:43 +0000
commit3fbd9768e8eff5cf3561b2758e41a85e9f44c195 (patch)
treeea00587615017db1e557c23fd2e4b2dc79b8d53c /scripts/bash_completion
parentea1d27c4db8aa38390177a5ce41e1cdc41c15ea1 (diff)
downloadptxdist-3fbd9768e8eff5cf3561b2758e41a85e9f44c195.tar.gz
ptxdist-3fbd9768e8eff5cf3561b2758e41a85e9f44c195.tar.xz
* 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
Diffstat (limited to 'scripts/bash_completion')
-rw-r--r--scripts/bash_completion55
1 files changed, 55 insertions, 0 deletions
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
+