Skip to content
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: if there are spaces in args, then wrap them with quotes #160

Merged
merged 4 commits into from
Jul 18, 2023

Conversation

FrankFang
Copy link
Contributor

Description

fix #157

src/parse.ts Outdated Show resolved Hide resolved
src/parse.ts Outdated
Comment on lines 29 to 32
const hasIfPresent = arg.startsWith('--if-present ')
const prefix = hasIfPresent ? '--if-present ' : ''
if (hasIfPresent)
arg = arg.slice('--if-present '.length)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this introduced here?

Copy link
Contributor Author

@FrankFang FrankFang Jun 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/antfu/ni/blob/d7951e7b5a5822a496c1f8c75c152c379bda4ab7/src/parse.ts#L59
Because --if-present has been inserted into the first parameter.
I tried to replace

args[0] = `--if-present ${args[0]}` 

to args.unshift('--if-present'), but this could lead to other issues, perhaps you could make some overall adjustments

@antfu antfu merged commit 3ae42dd into antfu-collective:main Jul 18, 2023
2 checks passed
@FrankFang FrankFang deleted the allow-spaces-in-args branch September 12, 2023 06:25
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.

Incorrect handling for quoted arguments
2 participants