Template strings have some parsing bugs #700
Answered
by
antonmedv
I-Want-ToBelieve
asked this question in
Help needed
-
// Define the signals
const signals = [
{ event: 'application_launched', label: 'yakite-application-launched', action: 'event application-launched --env YABAI_PROCESS_ID=$YABAI_PROCESS_ID' },
{ event: 'application_terminated', label: 'yakite-application-terminated', action: 'event application-terminated --env YABAI_PROCESS_ID=$YABAI_PROCESS_ID' }
]
for (const { event, label, action } of signals) {
console.log(`action=${action}`) // action=event application-launched --env YABAI_PROCESS_ID=$YABAI_PROCESS_ID
$`action=${action}` // action=$'event application-launched --env YABAI_PROCESS_ID=$YABAI_PROCESS_ID'
} |
Beta Was this translation helpful? Give feedback.
Answered by
antonmedv
Apr 13, 2024
Replies: 4 comments 12 replies
-
work well |
Beta Was this translation helpful? Give feedback.
0 replies
-
I am having issues with this problem. const PR_TITLE = "Sample PR title"
const body = "Sample body"
try {
await $`gh pr create --title=${PR_TITLE} --body=${body}`
} catch (error) {
throw chalk.red(error.stderr);
} will attempt to run this command
which is wrong. Expected output:
Does anyone know of a fix for this? |
Beta Was this translation helpful? Give feedback.
0 replies
-
Test function import { $ } from 'zx';
async function test(name) {
await $`echo hello: ${name}`;
}
test('world'); // Produces `set -euo pipefail;echo hello: world`
test('not spaces'); // Produces `set -euo pipefail;echo hello: $'not spaces'` |
Beta Was this translation helpful? Give feedback.
9 replies
-
This is a correct behavior. More info at https://google.github.io/zx/quotes |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
antonmedv
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a correct behavior. More info at https://google.github.io/zx/quotes