c-blake / cligen

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

Error invoking help using the default config #148

Closed SolitudeSF closed 4 years ago

SolitudeSF commented 4 years ago
/home/solitude/.local/etc/cligen/config: unexpected setting on_red
Expecting: options types defaultvalues descriptions command documentation arguments
/home/solitude/.local/etc/cligen/config: unexpected setting red
Expecting: options types defaultvalues descriptions command documentation arguments

Help displays, but these errors precede the help output.

SolitudeSF commented 4 years ago

ah, looks like space separated values have to be in quotes.

c-blake commented 4 years ago

Ah. Yeah. That sounds right.

c-blake commented 4 years ago

I think that was all that was wrong. Worked for me just now. That's a parsecfg constraint. TOML mode may be nicer, but I like not having the extra dependency. (Compile with -d:cgCfgToml for that).

c-blake commented 4 years ago

As an lc and procs user who may (or may not) also use $LC_THEME (or whatever variable you might use instead), it makes sense for me to tell you that A) the colors syntax in ~/.config/cligen/config is the same as for lc and procs and B) commands using that same cligen/humanUt:textAttrAliases system actually share definitions and C) the cligen ones run first.

The consequences of A) is that you can actually hard link/symlink alias files and that works, and BC) you don't really even need to symlink - you can just have the ~/.config/cligen ones define all you need once and use them in your ~/.config/lc and ~/.config/procs configurations.

You can also just ignore this info I'm giving and any re-issues will just redefine and should all just work. Processing such aliases just once instead of twice might save a few 10s of microseconds on program start-up, though, if that ever matters, and a single point of edit/definition might also be convenient.

kaushalmodi commented 4 years ago

@SolitudeSF

TOML mode may be nicer

Yes, TOML officially has array "types" (example 1, example 2) :D

c-blake commented 4 years ago

I should also have made clear that lc/procs/cligen sharing of configs may only work in non-TOML mode as the main cligen/cfUt.nim config file support is presently parsecfg-only.