Fail argument parsing on unknown values
Open
Nobody has claimed this yet.
good first issue
help wanted
- Dominant language
- Scala
- Stars
- 138
- Forks
- 91
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 13
Description
import zio.cli._
import zio.cli.HelpDoc.Span.text
import zio.Console.printLine
object Sample extends ZIOCliDefault {
val args: Args[String] = Args.text("xyz")
val command = Command("cli", args)
val cliApp = CliApp.make(
name = "Repro",
version = "",
summary = text(""),
command = command
) {
case input => printLine(s"Args parsed: $input")
}
}
Sample.main(Array("xyz", "abc"))
Current behavior:
Args parsed: xyz
Expected Behavior:
- Exit with non-zero code
- Print informative message
This behavior should be configurable, so if users want to ignore unknown arguments/options they can.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the Sample.main example with Args.text("xyz") and the extra "abc" argument, then trace argument parsing from CliApp.make. Done means unknown values produce a non-zero exit and an informative message, while users can configure whether unknown arguments or options are ignored.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100