We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
there's a bug in argparse which won't let me supply default values for an option that i set as multiple. here's a small poc which will error:
import argparse var p = newParser: option("-H", "--header", default=some(@["Content-Type: application/json"]), help="specify headers", multiple=true) try: let parsedArgs = p.parse(commandLineParams()) echo parsedArgs.header except UsageError as e: stderr.writeLine getCurrentExceptionMsg() quit(1)
Error: type mismatch: got <string, string, default: Option[seq[string]], help: string, multiple: bool> but expected one of: proc option(name1: string; name2 = ""; help = ""; default = none[string](); env = ""; multiple = false; choices: seq[string] = @[]; required = false; hidden = false) first type mismatch at position: 3 required type for default: Option[system.string] but expression 'default = some(@["Content-Type: application/json"])' is of type: Option[seq[string]] proc option[T](val: sink T): Option[T] first type mismatch at position: 2 extra argument given expression: option("-H", "--header", default = some(@["Content-Type: application/json"]),
If I change default to default=some("Content-Type: application/json"), the error will change:
default=some("Content-Type: application/json")
Error: type mismatch: got 'string' for '"Content-Type: application/json"' but expected 'seq[string]'
Everything works as expected if I don't supply default
The text was updated successfully, but these errors were encountered:
Start of issue #76, allowing for multiple defaults
4949322
No branches or pull requests
there's a bug in argparse which won't let me supply default values for an option that i set as multiple. here's a small poc which will error:
If I change default to
default=some("Content-Type: application/json")
, the error will change:Everything works as expected if I don't supply default
The text was updated successfully, but these errors were encountered: