36403: type -w += suffix alias

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>)
This commit is contained in:
Daniel Shahaf 2015-09-02 15:33:22 +00:00
parent 8dfdca8afd
commit 1ba2fac03d
3 changed files with 12 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2015-09-03 Daniel Shahaf <d.s@daniel.shahaf.name>
* 36403: Src/hashtable.c Test/A02alias.ztst: type -w +=
suffix alias
2015-09-02 Barton E. Schaefer <schaefer@zsh.org>
* unposted: Test/A05execution.ztst: test for 36393

View File

@ -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;
}

View File

@ -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