New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The splatting operator '@' cannot be used to reference variables in an expression. '@trigger' can be used only as an argument to a command. To reference variables in an expression use '$trigger' #21291
Comments
Try to escape command line arguments of
|
To add to @237dmitry's comment:
Applying the latter technique to your command (note how only the initial # Note the ` before the first @
pnpm dlx `@trigger.dev/cli@latest init -k tr_dev_1213241234zxcz -t https://cloud.trigger.dev
# Alternative with a quoted string
# Note the ` before the first @
pnpm dlx '@trigger.dev/cli@latest' init -k tr_dev_1213241234zxcz -t https://cloud.trigger.dev The list of PowerShell metacharacters in argument-parsing mode is:
Note:
|
I think this should work by default as countless npm modules will start from I'd rather want Otherwise, I have to open another terminal with Git Bash which is not convenient. |
The parsing seems to already handle other special characters like: |
Good point, @MartinGC94. There's several awkward behaviors around argument mode - both with native PowerShell commands and native (external) programs, and it may be worth revisiting all of them in the context of a focused feature request, so they can be addressed with a single change, which will at least technically amount to breaking changes. Using the case at hand as an example: Here, the issue is that the
Given that Arguably, also treating However, even in native program calls treating an isolated argument such as Currently, something like Perhaps But the point is that all these behaviors and edge cases need to spelled out and agreed upon in detail before potentially making changes. See also:
|
There seems to be two possible options here and both might be bucket 3 in terms of a breaking change.
|
A reddit thread indicates that there's also been some parsing regression between 5.1 and 7 when |
Yes, it looks like WinPS - sensibly - falls back to treating the whole argument like an expandable string (
In both editions, however, referencing existing variables via namespace variable notation does work, so that something like When you follow a "splatted" namespace variable reference with a non-variable-name character other than However - in PS Core only - a subsequent |
The WG discussed this and believe that this is operating as it was designed. You will need to either quote or escape in order to avoid the variable parsing behavior. |
This issue has been marked as by-design and has not had any activity for 1 day. It has been closed for housekeeping purposes. |
📣 Hey @deadcoder0904, how did we do? We would love to hear your feedback with the link below! 🗣️ 🔗 https://aka.ms/PSRepoFeedback |
@deadcoder0904, perhaps the following translation of the WG decision helps:
This means (do tell me if I got things wrong):
This is very much in the spirit of #18502 (comment) |
Yeah, I'm a bit confused about the WG decision as well. One of the recent goals in PowerShell was to make native program arguments "just work" to make it a nicer shell to use, hence all the PSNative* experimental features we've seen over the last couple of releases. |
I agree that this is working as currently designed like the WG have said but do wonder if it could it be possible in future for in scenarios like this to have the engine ignore specific symbols like |
Let's start with the basics, @kilasuit:
So which of the following behaviors is as designed, and what motivated the change in behavior between WinPS and PS Core, and where is that change documented? # Run on Windows
cmd /c echo @foo=bar WinPS output:
PS Core output:
Also note that the following works in both editions, and is behavior that must therefore be preserved: & { cmd /c echo @args } foo bar # -> 'foo bar' in both editions |
Frankly, this will lead to ever-lasting confusion as to which executable exhibits which behavior in which specific version. It is highly regrettable that a similar dance has already been started with respect to the ill-fated |
Prerequisites
Steps to reproduce
pnpm dlx @trigger.dev/cli@latest init -k tr_dev_1213241234zxcz -t https://cloud.trigger.dev
in Terminal & hit EnterExpected behavior
Actual behavior
Error details
Environment data
Visuals
No response
The text was updated successfully, but these errors were encountered: