intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: jani.nikula@intel.com
Subject: [dim PATCH 4/4] dim: run executables in $PATH named dim-subcommand as dim subcommands
Date: Tue,  4 Apr 2017 16:59:02 +0300	[thread overview]
Message-ID: <1491314342-7122-4-git-send-email-jani.nikula@intel.com> (raw)
In-Reply-To: <1491314342-7122-1-git-send-email-jani.nikula@intel.com>

Similar to git. Don't allow override of internal commands though.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 dim | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/dim b/dim
index 45dc07cd0426..85da1542087e 100755
--- a/dim
+++ b/dim
@@ -1907,6 +1907,12 @@ fi
 # look up the function by the subcommand name
 subcmd_func=dim_${subcmd//-/_}
 if ! declare -f $subcmd_func >/dev/null; then
+	# look up dim-subcommand in PATH, and run it
+	ext_subcmd=${subcmd_func//_/-}
+	if hash $ext_subcmd 2>/dev/null; then
+		exec $ext_subcmd "$@"
+	fi
+
 	echoerr "'$subcommand' is not a dim command."
 	dim_usage
 	exit 1
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2017-04-04 13:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-04 13:58 [dim PATCH 1/4] dim: do not bail out if the script is not up-to-date Jani Nikula
2017-04-04 13:59 ` [dim PATCH 2/4] dim: move dim update check near the end Jani Nikula
2017-04-04 13:59 ` [dim PATCH 3/4] dim: move helper functions above command line options handling Jani Nikula
2017-04-04 13:59 ` Jani Nikula [this message]
2017-04-04 15:03   ` [dim PATCH 4/4] dim: run executables in $PATH named dim-subcommand as dim subcommands Daniel Vetter
2017-04-05  7:28     ` Jani Nikula
2017-04-05  9:12       ` Daniel Vetter

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=1491314342-7122-4-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).