summaryrefslogtreecommitdiffstats
path: root/scripts/bash_completion
diff options
context:
space:
mode:
authorBenoît Burnichon <benoit.burnichon@airtag.com>2012-10-01 12:51:21 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2012-10-04 11:39:35 +0200
commit1533cab7615c5dfc4dafbeaf70b6bbe1455609b5 (patch)
tree6be5116f7c62b3e82dace8dbf0ba22c01a05f6e9 /scripts/bash_completion
parent4efc90d668fd7fc2c446b488cd53f76a18af298c (diff)
downloadptxdist-1533cab7615c5dfc4dafbeaf70b6bbe1455609b5.tar.gz
ptxdist-1533cab7615c5dfc4dafbeaf70b6bbe1455609b5.tar.xz
bash_completion: Allow links to be completed
using this bash_completion allows using p <Tab> to complete commands even if ptxdist is installed on the system Signed-off-by: Benoît Burnichon <benoit.burnichon@airtag.com> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'scripts/bash_completion')
-rw-r--r--scripts/bash_completion14
1 files changed, 10 insertions, 4 deletions
diff --git a/scripts/bash_completion b/scripts/bash_completion
index 3d4bc389b..2a51276d0 100644
--- a/scripts/bash_completion
+++ b/scripts/bash_completion
@@ -8,7 +8,13 @@ if have ptxdist; then
_ptxdist_completion()
{
- local cur cmds opts
+ local cur cmds opts _ptxdist_cmd
+
+ if [ "${COMP_WORDS[0]}" = "ptxdist" ]; then
+ _ptxdist_cmd="ptxdist"
+ else
+ _ptxdist_cmd="${COMP_WORDS[0]}"
+ fi
COMPREPLY=()
cur=( $(_get_cword) )
@@ -41,13 +47,13 @@ _ptxdist_completion()
[ $COMP_CWORD -lt 3 ] && _filedir
;;
get|extract|prepare|compile|install|targetinstall|tags)
- COMPREPLY=( $( compgen -W "${opts} $( ptxdist print PTX_PACKAGES_SELECTED )" -- $cur ) )
+ COMPREPLY=( $( compgen -W "${opts} $( $_ptxdist_cmd print PTX_PACKAGES_SELECTED )" -- $cur ) )
;;
clean)
- COMPREPLY=( $( compgen -W "${opts} $( ptxdist print PTX_PACKAGES_SELECTED ) root" -- $cur ) )
+ COMPREPLY=( $( compgen -W "${opts} $( $_ptxdist_cmd 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 ) )
+ COMPREPLY=( $( compgen -W "${opts} $( pushd $($_ptxdist_cmd 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) )