howto: simulate K V checked args list
i want to write a helper tool to edit configure on my target box.
suppose we have config-entries constants:
# `key1` accept only `value1` and `value2`
key1: value1 value2
key2: foo bar baz
is there a way to let my tool command line like:
set-helper key1 value1 key2 refused
and with param validation works with both key and values?
i have imagined a way that takes vector<string> arg and do check in a sort-of-callback. but seems not fit the CLI11 design principle. any suggestion?
The simplest way is probably just a custom callback that does some additional checks. You could probably do a stateful validator that does the checks inline, but I think in this case a callback on the app that does the checks would be the simplest choice, then you have access to the entire vector.
i hv tried that callback way. it did work.
however, sadly, the code looks like i hv no CLI11 imported...