Closed pprindeville closed 7 months ago
One complexity is plugins must be loaded before callbacks are called.
This means that you need to have a proper install, configuration-file etc.
You cant just type clixon_cli -V
on a bare binary.
One could consider a simpler variant just returning CLIXON_VERSION_STRING and exit.
Or alternatively, always printing CLIXON_VERSION_STRING forst and then trying to print any callback output. If that would fail (eg on an uninstalled system) it just quits after the version print.
The drawback with that would be that you would always get that printout, you could not customize it.
@pprindeville ?
Also, should version string be printed on stderr ot stdout?
Working backwards, I'd print to stdout
because it's not a error, and I might want capture it in $(...)
anyway.
What about an external static pointer to a string constant that the user is required to set?
stdout: OK static ptr: No, same problem, still need to load plugin code (where the static pointer points to), and in order to find the plugin code you need the config file.
Committed -V with first a mandatory CLIXON_VERSION followed by customized plugin callbacks.
Rather than doing
echo -e "show version\nexit\n" | clixon_cli
it would be nicer to just haveclixon_cli -V
give an answer.That said, the version string should be one provided by the developer, not simply
CLIXON_VERSION_STRING
, etc.