-
-
Notifications
You must be signed in to change notification settings - Fork 419
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
## Fix `cli` package from mangling options with equal signs | ||
|
||
The current command parser in the `cli` package cuts option arguments of `String` type at the first equal sign. This release fixes the problem for long options (`--option=foo=bar`) and for short options such as `-O=foo=bar`. Short options such as `-Ofoo=bar` will continue to raise an "ambiguous args" error. | ||
|
||
The code below shows the bug, with the option argument being cut short at the first equal sign. The code below prints "foo" instead of the complete value, "foo=bar". The same is true when uses the short version of the option, like `-t=foo=bar`. | ||
|
||
```pony | ||
use "cli" | ||
actor Main | ||
new create(env: Env) => | ||
try | ||
let cs = | ||
CommandSpec.leaf("simple", "", [ | ||
OptionSpec.string("test" where short' = 't') | ||
])? | ||
let args: Array[String] = [ | ||
"ignored"; "--test=foo=bar" | ||
] | ||
let cmdErr = CommandParser(cs).parse(args) as Command | ||
env.out.print(cmdErr.option("test").string()) | ||
end | ||
``` |