Skip to content

fix: enhance quote to handle empty args - #1113

Merged
antonmedv merged 1 commit into
google:mainfrom
antongolub:fix-quote-empty
Mar 1, 2025
Merged

fix: enhance quote to handle empty args#1113
antonmedv merged 1 commit into
google:mainfrom
antongolub:fix-quote-empty

Conversation

@antongolub

@antongolub antongolub commented Mar 1, 2025

Copy link
Copy Markdown
Collaborator

closes #999
closes #1112

const _$ = $({ prefix: '', postfix: '' })
const p1 = _$`echo ${['-n', 'foo']}`
assert.equal(p1.cmd, 'echo -n foo')
assert.equal((await p1).toString(), 'foo')

const p2 = _$`echo ${[1, '', '*', '2']}`
assert.equal(p2.cmd, `echo 1 $'' $'*' 2`)
assert.equal((await p2).toString(), `1  * 2\n`)
  • Tests pass
  • Appropriate changes to README are included in PR

@antongolub
antongolub requested a review from antonmedv March 1, 2025 16:42
@antonmedv
antonmedv merged commit eff2d70 into google:main Mar 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Empty string incorrectly not quoted in an array

2 participants