neithere / argh

An argparse wrapper that doesn't make you say "argh" each time you deal with it.
http://argh.rtfd.org
GNU Lesser General Public License v3.0
369 stars 55 forks source link

Setting the argument name with `dest` is ignored #224

Closed mathieulongtin closed 2 months ago

mathieulongtin commented 7 months ago

Summary

You used to be able to override the argument name with dest, but that doesn't work anymore.

This was useful to allow things like --json without overriding the json module, for example.

To Reproduce

Python script:

import argh

@argh.arg("-l", dest="list_files")
def somefunc(list_files=False):
  pass

Command line input/output:

$ my-script.py ...
argh.assembling.ArgumentNameMappingError: somefunc: argument -l does not fit function signature: -l/--list-files

Expected behavior

The old behavior where if dest is supplied, it overrides any guesses as to the destination argument.

Environment

Additional context

Add any other context about the problem here.

neithere commented 7 months ago

Thanks, confirming, scheduled the next bugfix release.

neithere commented 7 months ago

Related, not necessarily a replacement: #222.