Skip to content

Support for parsing negative numbers #15

@serba

Description

@serba

In my project I need ability to pass negative numbers as option arguments, but unfortunately it doesn't work. It seems parser treats negative numbers as options themselves.

You can easily reproduce this by changing TestPrimitiveExample test (see "Option must have a value: --int value" failure)

--- a/jewelcli/src/test/java/com/lexicalscope/jewel/cli/examples/TestPrimitiveExample.java
+++ b/jewelcli/src/test/java/com/lexicalscope/jewel/cli/examples/TestPrimitiveExample.java
@@ -13,7 +13,7 @@ public class TestPrimitiveExample {
                 new String[] { "--boolean",
                          "--byte", "1",
                          "--short", "2",
-                         "--int", "3",
+                         "--int", "-3",
                          "--long", "4",
                          "--float", "4.1",
                          "--double", "4.2",

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions