Skip to content

fix: parameter cannot start with a hyphen - #171

Closed
chen-sys wants to merge 2 commits into
unjs:mainfrom
chen-sys:feature/fix-parser
Closed

chen-sys wants to merge 2 commits into
unjs:mainfrom
chen-sys:feature/fix-parser

Conversation

@chen-sys

Copy link
Copy Markdown

If there is a string parameter in the command, the string will not be able to start with a hyphen (-).
For example, --params "-a 192.168.1.1 -b -c" will get empty params.

@pi0

pi0 commented Oct 12, 2024

Copy link
Copy Markdown
Member

Can you please add some unit tests?

@codecov

codecov Bot commented Oct 12, 2024 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@fea15c4). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/_parser.ts 0.00% 2 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff           @@
##             main    #171   +/-   ##
======================================
  Coverage        ?   5.06%           
======================================
  Files           ?      12           
  Lines           ?     810           
  Branches        ?      25           
======================================
  Hits            ?      41           
  Misses          ?     758           
  Partials        ?      11           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pi0

pi0 commented Mar 15, 2026

Copy link
Copy Markdown
Member

Closing — the underlying issue is already fixed in the current codebase (the parser correctly handles string values starting with a hyphen). Regression tests have been added in 49a79a4 to guard against future regressions. Thanks for the report!

@pi0 pi0 closed this Mar 15, 2026
pi0 added a commit that referenced this pull request Mar 15, 2026
…171)

Ensure string args starting with `-` are correctly parsed.
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.

2 participants