iffy / nim-argparse

Argument parsing for Nim
MIT License
120 stars 8 forks source link

undeclared field in backend when using arg() with hyphens in the arg name #83

Closed Phytolizer closed 1 year ago

Phytolizer commented 1 year ago

In the following example:

import argparse

discard newParser:
  arg("some-stuff")

I am seeing the following error on version 3.0.1:

/home/kyle/dev/dbTransfer/example.nim(3, 9) template/generic instantiation of `newParser` from here
/home/kyle/.nimble/pkgs/argparse-3.0.1/argparse/backend.nim(512, 17) Error: undeclared field: 'some-stuff'

Hyphens in general are handled pretty inconsistently; for example, they are translated to underscores (I think?) in option(), but not in command(), requiring you to escape the field name with backticks in that case.

Phytolizer commented 1 year ago

It may or may not be relevant, but this error occurs on Nim 1.6.8 (stable channel).

iffy commented 1 year ago

Fixed in v4.0.0

Phytolizer commented 1 year ago

Thanks!