I've found some unexpected "Alias for:" messages, especially while running particularly long commands:
$ echo longlonglonglonglonglonglong linelinelinelinelinelinelinelinelinelineline
Alias for: echo longlonglonglonglonglonglong linelinelinelinelinelinelinelinelinelinelin
longlonglonglonglonglonglong linelinelinelinelinelinelinelinelinelineline
I believe this is because the second argument to the preexec hook can be trimmed and what we really want is to compare the command with the third argument, which is not trimmed.
Another issue is with export (maybe some other builtins too, but I've only seen export so far):
$ export TEST=x
Alias for: export TEST=x
This one is because expanded command for some reason has a trailing whitespace. I'm not sure, maybe this is actually a zsh bug, but we can easily workaround this by removing the trailing whitespace before doing comparison.
Would you be interested in PRs to fix that? Any objections to
- Using
CMD_EXPANDED=$3 instead of CMD_EXPANDED=$2
- Removal trailing whitespace from CMD/CMD_EXPANDED?
I've found some unexpected "Alias for:" messages, especially while running particularly long commands:
I believe this is because the second argument to the preexec hook can be trimmed and what we really want is to compare the command with the third argument, which is not trimmed.
Another issue is with
export(maybe some other builtins too, but I've only seen export so far):This one is because expanded command for some reason has a trailing whitespace. I'm not sure, maybe this is actually a zsh bug, but we can easily workaround this by removing the trailing whitespace before doing comparison.
Would you be interested in PRs to fix that? Any objections to
CMD_EXPANDED=$3instead ofCMD_EXPANDED=$2