google / zx

A tool for writing better scripts

Home Page:https://npmjs.com/package/zx

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

multiline commands?

pvinis opened this issue · comments

Expected Behavior

I should be able to run something like

await $`detect-secrets scan
               --exclude-files /\.lock$/
               --exclude-files /\.png$/
               --baseline .secrets.baseline
`

I wonder if something like https://www.npmjs.com/package/multilines is a good way to use this? like

await $`
  | detect-secrets scan
  |    --exclude-files /\.lock$/
  |    --exclude-files /\.png$/
  |    --baseline .secrets.baseline
`

Actual Behavior

not able to do it. each line is read as a new command.

Specifications

  • Version: zx version 5.2.0
  • Platform: macos 12

I guess I came here too quickly. the following totally works:

await $`detect-secrets scan                \
               --exclude-files /\.lock$/   \
               --exclude-files /\.png$/    \
               --baseline .secrets.baseline
`

But making inline comments is HARD, like:

await $`detect-secrets scan                \
               --exclude-files /\.lock$/   \
               --exclude-files /\.png$/ \`# no need to check image files\`    \
               --baseline .secrets.baseline
`

I guess I'll keep these comments just before the command.

ezoic increase your site revenue