Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
zsh alias $@ argument forwarding vs function💡 Result:
In zsh, an alias is just textual substitution of the first word of a command line; it does not receive positional parameters, so
$@inside an alias does not mean “the alias’s arguments” (it either expands when the alias is defined or is treated literally, depending on quoting) and won’t forward what you type after the alias name. [1], [2], [3]What to use instead: a function
Use a function when you need argument forwarding (or any real logic):
"$@"expands to the arguments passed to the function call. [2]When an alias “seems” to forward args
This works because the shell appends the extra words after the alias expansion:
But you still can’t inspect/rewrite/conditionally use those arguments from within an alias (no reliable
$@concept). [1]If you tried something like this
That fails for the reason above: aliases aren’t functions, so they don’t have
$@; make it a function (and usually do the detection once, at startup, if possible). [3]Sources:
[1] Zsh Guide: aliases don’t take arguments; use functions (zsh.sourceforge.io) (zsh.sourceforge.io)
[2] Ask Different: use a function +
"$@"to pass arguments (apple.stackexchange.com) (apple.stackexchange.com)[3] Reddit explanation: “Aliases aren’t functions, they don’t have
$@” (reddit.com) (reddit.com)Citations:
Aliases won't forward invocation arguments; use functions instead.
These aliases attempt to forward arguments via
$@, but in zsh, aliases perform only textual substitution and do not receive positional parameters. The$@inside the alias text will not expand to the arguments passed when callingcldo,clds, orcldk.Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents