* [PATCH] type -w += suffix alias
@ 2015-09-02 15:33 Daniel Shahaf
0 siblings, 0 replies; only message in thread
From: Daniel Shahaf @ 2015-09-02 15:33 UTC (permalink / raw)
To: zsh-workers
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-09-02 15:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-02 15:33 [PATCH] type -w += suffix alias Daniel Shahaf
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).