mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: "Benoît Burnichon" <benoit.burnichon@airtag.com>
To: ptxdist@pengutronix.de
Subject: [ptxdist] [PATCH] Allow links to be completed
Date: Mon, 1 Oct 2012 12:51:21 +0200	[thread overview]
Message-ID: <1349088681-14602-1-git-send-email-benoit.burnichon@airtag.com> (raw)
In-Reply-To: <1348844873-23722-1-git-send-email-benoit.burnichon@airtag.com>

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>
---
 scripts/bash_completion |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/scripts/bash_completion b/scripts/bash_completion
index 3d4bc38..2a51276 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) )
-- 
1.7.2.5


-- 
ptxdist mailing list
ptxdist@pengutronix.de

      parent reply	other threads:[~2012-10-01 10:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-28 15:07 [ptxdist] [PATCH] Allow p link " Benoît Burnichon
2012-09-30 13:02 ` Michael Olbrich
2012-10-01 10:25   ` Benoît Burnichon
2012-10-01 10:51 ` Benoît Burnichon [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1349088681-14602-1-git-send-email-benoit.burnichon@airtag.com \
    --to=benoit.burnichon@airtag.com \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox