Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for -V option to give version #472

Closed
pprindeville opened this issue Dec 12, 2023 · 5 comments
Closed

Add support for -V option to give version #472

pprindeville opened this issue Dec 12, 2023 · 5 comments

Comments

@pprindeville
Copy link
Contributor

Rather than doing echo -e "show version\nexit\n" | clixon_cli it would be nicer to just have clixon_cli -V give an answer.

That said, the version string should be one provided by the developer, not simply CLIXON_VERSION_STRING, etc.

@olofhagsand
Copy link
Member

olofhagsand commented Dec 14, 2023

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 ?

@olofhagsand
Copy link
Member

Also, should version string be printed on stderr ot stdout?

@pprindeville
Copy link
Contributor Author

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?

@olofhagsand
Copy link
Member

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.

@olofhagsand
Copy link
Member

Committed -V with first a mandatory CLIXON_VERSION followed by customized plugin callbacks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants