Skip to content

Commit

Permalink
Add release notes
Browse files Browse the repository at this point in the history
  • Loading branch information
ergl committed Nov 22, 2021
1 parent ca9d2d0 commit 7057c2d
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .release-notes/fix_cli.md
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
```

0 comments on commit 7057c2d

Please # to comment.