argtable / argtable3

A single-file, ANSI C, command-line parsing library that parses GNU-style command-line options.
http://www.argtable.org
Other
372 stars 65 forks source link

Table entries with empty glossary strings may displayed. #72

Closed krishna116 closed 2 years ago

krishna116 commented 2 years ago

If I using this line, when I run "foo.exe --help", the file positional argument will displayed. file = arg_filen(NULL, NULL, "<file>", 1, 1, ""), If I using this line, when I run "foo.exe --help", the file positional argument will not displayed. file = arg_filen(NULL, NULL, "<file>", 1, 1, NULL),

I have read the site's tutorial: https://www.argtable.org/tutorial/, it says "...Table entries with NULL glossary strings are not displayed.",

so I don't know if it is a bug?

tomghuang commented 2 years ago

Hi @krishna116, I'd say it is not a bug, but an expected behavior.

When you provide an empty string "", it means that you want to display an empty string. If you don't want to display anything, you should provide a NULL pointer. It is a pretty standard API design pattern.

krishna116 commented 2 years ago

Got it, thank you.