-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
fix: allow spaces in commands #778
Conversation
@@ -48,7 +48,7 @@ export function noquote(): string { | |||
} | |||
|
|||
export function quote(arg: string) { | |||
if (/^[a-z0-9/_.\-@:=]+$/i.test(arg) || arg === '') { | |||
if (/^[a-z0-9/_.\-@:= ]+$/i.test(arg) || arg === '') { |
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.
This is wrong. quote should NOT allow space char.
Please read doc at https://google.github.io/zx/quotes |
@@ -57,6 +57,7 @@ describe('util', () => { | |||
|
|||
test('quote()', () => { | |||
assert.ok(quote('string') === 'string') | |||
assert.ok(quote('this that') === 'this that') |
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.
The quote('this that')
MUST quote output with $
.
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.
@antonmedv I think I have come at a side effect of the real issue then. I will re-attempt one more time.
@@ -5,7 +5,7 @@ | |||
|
|||
await $`cat package.json | grep name` | |||
|
|||
let branch = await $`git branch --show-current` | |||
let { stdout: branch } = await $`git branch --show-current` |
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.
Noticed this discrepancy in the documentation.
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.
Nope. This is not a discrepancy. zx works this way.
@@ -57,6 +57,7 @@ describe('util', () => { | |||
|
|||
test('quote()', () => { | |||
assert.ok(quote('string') === 'string') | |||
assert.ok(quote('this that') === 'this that') |
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.
@antonmedv I think I have come at a side effect of the real issue then. I will re-attempt one more time.
Fixes #700
Allows for spaces to exist in commands.