libelektra
libelektra copied to clipboard
elektraGetOptsHelpMessage docs/examples use 'opt/arg/name' instead of 'opt/arg/help'
Steps to Reproduce the Problem
...
(ks, keyNew (baseKeyName "spec:/test/path", KEY_META, "description", "Some description", \
KEY_META, "opt", "p", \
KEY_META, "opt/arg/name", "path", \
KEY_META, "opt/long", "path", \
KEY_META, "opt/arg", "required", KEY_END)); \
...
... elektraGetOpts (ks, argc, (const char **) argv, (const char **) environ, errorKey);
...
char * help = elektraGetOptsHelpMessage (errorKey, NULL, NULL);
The --help output ignores the specified opt/arg/name and always uses ARG instead.
Expected Result
OPTIONS
...
-p path, --profile=path Some description.
...
Actual Result
OPTIONS
...
-p ARG, --profile=ARG Some description.
...
Could you try with opt/arg/help instead?
I think that's what is actually used. See
https://github.com/ElektraInitiative/libelektra/blob/d57703bd1eaff0626fcfa8290773d68832085c4f/src/libs/opts/opts.c#L781-L783
https://github.com/ElektraInitiative/libelektra/blob/d57703bd1eaff0626fcfa8290773d68832085c4f/src/libs/opts/opts.c#L823
https://github.com/ElektraInitiative/libelektra/blob/d57703bd1eaff0626fcfa8290773d68832085c4f/src/libs/opts/opts.c#L925
https://github.com/ElektraInitiative/libelektra/blob/d57703bd1eaff0626fcfa8290773d68832085c4f/src/libs/opts/opts.c#L971-L992
Actually, yes. I'll update the rm example in the tutorial[1], since /name is used there.
[1] https://www.libelektra.org/tutorials/command-line-options#examples
should I change the Issue title and description, or leave it?
I'll update the rm example in the tutorial
Please also check other docs, like examples/opts.c and examples/gopts.c
should I change the Issue title and description, or leave it?
I updated it.