c-blake / cligen

Nim library to infer/generate command-line-interfaces / option / argument parsing; Docs at
https://c-blake.github.io/cligen/
ISC License
501 stars 23 forks source link

Can't supress --help-syntax option #175

Closed halloleo closed 3 years ago

halloleo commented 3 years ago

I try to suppress the --help-syntax option, so I added {"--help-syntax": "SUPPRESS"} to the help dictionary, but cligen complains because --help-syntax is not an API option.

How can I suppress --help-syntax?

c-blake commented 3 years ago

As per https://github.com/c-blake/cligen/commit/43f80c2fdfddf1d2fb4794b00ae72ccca58c60b0, somewhere after import cligen and before your dispatch just do:

clCfg.helpSyntax = ""

This won't make mycmd --help-syntax illegal, but will suppress it in the help table. For non-internal options you can follow tests/OmitInHelpTable.nim.

I personally think suppressing syntax help is a little user-hostile since cligen expands otherwise typical syntax quite a bit, but to each his own.

halloleo commented 3 years ago

Thanks for this. You are very helpful, @c-blake.

Works as advertised - and is certainly good enough for me. :smile:

One question though: Where does the helpSyntax field come from? In ClCfg's description I cannot find it..

halloleo commented 3 years ago

Ups, sorry, my bad. I just saw that in the source code the helpSyntax field is listed.