Skip to content

Cannot pass negative number as option #651

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

Closed
amoffet opened this issue Jan 30, 2023 · 0 comments
Closed

Cannot pass negative number as option #651

amoffet opened this issue Jan 30, 2023 · 0 comments
Assignees
Labels
branch/2.1.x Issue for a branch branch/3.0.x Issue for a branch for/backport For backporting type/bug Is a bug report
Milestone

Comments

@amoffet
Copy link

amoffet commented Jan 30, 2023

Given:

@ShellMethod("Add array numbers.")
public double addDoubles(@ShellOption(arity = 3) double[] numbers) {
return Arrays.stream(numbers).sum();
}

try
add-doubles 1.2 -2.1 4.4
or
add-doubles 1.2 "-2.1" 4.4

The returned error is "Unrecognised option '-2.1'"

It doesn't matter if you explicitly name an option. There must be a way to do this...

@github-actions github-actions bot added the status/need-triage Team needs to triage and take a first look label Jan 30, 2023
@jvalkeal jvalkeal added type/bug Is a bug report and removed status/need-triage Team needs to triage and take a first look labels Jan 31, 2023
@jvalkeal jvalkeal added this to the 3.1.0-M1 milestone Feb 1, 2023
@jvalkeal jvalkeal self-assigned this Feb 1, 2023
@jvalkeal jvalkeal added for/backport For backporting branch/2.1.x Issue for a branch branch/3.0.x Issue for a branch labels Feb 1, 2023
jvalkeal added a commit that referenced this issue Feb 1, 2023
- Now lexing better with valid options
- Only report unrecognised option with double dash
  as current parser don't have structure to do
  deeper analysis.
- Backport #651
- Fixes #652
jvalkeal added a commit that referenced this issue Feb 1, 2023
- Now lexing better with valid options
- Only report unrecognised option with double dash
  as current parser don't have structure to do
  deeper analysis.
- Backport #651
- Fixes #653
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
branch/2.1.x Issue for a branch branch/3.0.x Issue for a branch for/backport For backporting type/bug Is a bug report
Projects
None yet
Development

No branches or pull requests

2 participants