akamensky / argparse

Argparse for golang. Just because `flag` sucks
MIT License
611 stars 62 forks source link

Allow unambiguous shortened long-options #36

Closed chungy closed 4 years ago

chungy commented 5 years ago

With GNU getopt and friends (I believe Python argparse included, but I haven't tested it to write this issue report), long options may be abbreviated to the shortest unambiguous version and needn't be typed in full.

For example, in a program that has both --verbose and --version, --ver cannot work since it would match either of them, but --vers would act the same as --version, and --verb would act the same as --verbose.

densestvoid commented 5 years ago

Python argparse confirmed, according to https://docs.python.org/3/library/argparse.html, allow_abbrev is a parameter for ArgumentParser object.

akamensky commented 5 years ago

I don't think that is necessary. This adds ambiguity to the options as well as adds on complexity of parsing.

This library is inspired by argparse, it does not intent on copying it 100% (which would not be possible anyway because of strict typing).