vlang / v

Simple, fast, safe, compiled language for developing maintainable software. Compiles itself in <1s with zero library dependencies. Supports automatic C => V translation. https://vlang.io
MIT License
35.88k stars 2.17k forks source link

Change flags module to follow the common pattern #7090

Open danieldaeschle opened 4 years ago

danieldaeschle commented 4 years ago

Currently we have -cg, -keepc and things like -prod. The common pattern is to have --prod (double - for longer flags) and -g (single - for only one char). -cg would be the shorthand for -c -g. Then -cg flag must be used with --cg

https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html http://www.gnu.org/software/libc/manual/html_node/Getopt-Long-Options.html

JalonSolov commented 3 days ago

This one has been hanging around a long time. I think it can simply be closed, if there are no big objections.

The fact is that there are 2 conventions, the GNU convention (short flags with -, long ones with --, combine short ones is OK), and the POSIX convention (only - regardless of flag length, no combining).

The GNU convention is, indeed, used in many programs. However, the POSIX convention is also used in others, and is just as valid. V currently uses the POSIX convention.

JalonSolov commented 3 days ago

Also, the current flag module has been updated so you can choose which style you want to use.