From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: [PATCH] type -w += suffix alias
Date: Wed, 2 Sep 2015 15:33:22 +0000 [thread overview]
Message-ID: <20150902153322.GA9026@tarsus.local2> (raw)
This makes 'type -w' distinguish suffix aliases from regular aliases,
like bare 'type' already does.
Use-case: detecting programmatically whether the command word is indeed
a valid command word (see <https://github.com/zsh-users/zsh-syntax-highlighting/issues/126>)
diff --git a/Src/hashtable.c b/Src/hashtable.c
index 90739a8..2d1ff87 100644
--- a/Src/hashtable.c
+++ b/Src/hashtable.c
@@ -1234,7 +1234,10 @@ printaliasnode(HashNode hn, int printflags)
}
if (printflags & PRINT_WHENCE_WORD) {
- printf("%s: alias\n", a->node.nam);
+ if (a->node.flags & ALIAS_SUFFIX)
+ printf("%s: suffix alias\n", a->node.nam);
+ else
+ printf("%s: alias\n", a->node.nam);
return;
}
diff --git a/Test/A02alias.ztst b/Test/A02alias.ztst
index b294e65..3896178 100644
--- a/Test/A02alias.ztst
+++ b/Test/A02alias.ztst
@@ -91,5 +91,8 @@
0:unalias -a
alias -s foo=print
+ type bar.foo; type -w bar.foo
unalias -as
0:unalias -as
+>foo is a suffix alias for print
+>foo: suffix alias
reply other threads:[~2015-09-02 15:33 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20150902153322.GA9026@tarsus.local2 \
--to=d.s@daniel.shahaf.name \
--cc=zsh-workers@zsh.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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
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).