From: Jani Nikula <jani.nikula@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: jani.nikula@intel.com
Subject: [maintainer-tools PATCH 8/8] completion: complete aliases like the actual command
Date: Thu, 18 Feb 2016 18:20:54 +0200 [thread overview]
Message-ID: <1455812454-19187-8-git-send-email-jani.nikula@intel.com> (raw)
In-Reply-To: <1455812454-19187-1-git-send-email-jani.nikula@intel.com>
Map aliases to the actual commands. No need to know all the aliases.
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
bash_completion | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/bash_completion b/bash_completion
index 4a9d981709a0..9f659b4ebcce 100644
--- a/bash_completion
+++ b/bash_completion
@@ -44,20 +44,26 @@ _dim ()
return 0
fi
+ # complete aliases like the actual command
+ local aliasref=$(dim list-aliases | sed -n "s/^${arg}\t\(.*\)/\1/p")
+ if [[ -n "$aliasref" ]]; then
+ arg="$aliasref"
+ fi
+
case "${arg}" in
push-branch)
COMPREPLY=( $( compgen -W "-f $nightly_branches" -- $cur ) )
;;
- push-queued|pq|push-fixes|pf|push-next-fixes|pnf)
+ push-queued|push-fixes|push-next-fixes)
COMPREPLY=( $( compgen -W "-f" -- $cur ) )
;;
- apply-branch|ab|sob)
+ apply-branch)
COMPREPLY=( $( compgen -W "-s $nightly_branches" -- $cur ) )
;;
- apply-queued|aq|apply-fixes|af|apply-next-fixes|anf)
+ apply-queued|apply-fixes|apply-next-fixes)
COMPREPLY=( $( compgen -W "-s" -- $cur ) )
;;
- magic-patch|mp)
+ magic-patch)
if [[ $args == 2 ]]; then
COMPREPLY=( $( compgen -o nospace -W "-a" -- $cur ) )
fi
@@ -65,7 +71,7 @@ _dim ()
tc|fixes)
# FIXME needs a git sha1
;;
- check-patch|cp)
+ checkpatch)
# FIXME needs a git sha1
;;
pull-request)
@@ -85,7 +91,7 @@ _dim ()
COMPREPLY=( $( compgen -o nospace -W "drm- topic/" -- $cur ) )
fi
;;
- checkout|co)
+ checkout)
if [[ $args == 2 ]]; then
COMPREPLY=( $( compgen -W "$nightly_branches" -- $cur ) )
fi
--
2.1.4
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-02-18 16:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-18 16:20 [maintainer-tools PATCH 1/8] completion: require bash completion package and use it Jani Nikula
2016-02-18 16:20 ` [maintainer-tools PATCH 2/8] dim: add list-branches subcommand to list nightly branches Jani Nikula
2016-02-18 16:20 ` [maintainer-tools PATCH 3/8] dim: add list-upstreams subcommand to list upstream branches Jani Nikula
2016-02-18 16:20 ` [maintainer-tools PATCH 4/8] completion: use the dim helpers to complete nightly and " Jani Nikula
2016-02-18 16:20 ` [maintainer-tools PATCH 5/8] dim: add list-commands subcommand to list all subcommands Jani Nikula
2016-02-18 16:20 ` [maintainer-tools PATCH 6/8] dim: rename alias subcommand to list-aliases Jani Nikula
2016-02-18 16:20 ` [maintainer-tools PATCH 7/8] completion: use the dim helpers to complete subcommands and aliases Jani Nikula
2016-02-18 16:20 ` Jani Nikula [this message]
2016-02-19 14:31 ` [maintainer-tools PATCH 1/8] completion: require bash completion package and use it Jani Nikula
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=1455812454-19187-8-git-send-email-jani.nikula@intel.com \
--to=jani.nikula@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
/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;
as well as URLs for NNTP newsgroup(s).