-
Notifications
You must be signed in to change notification settings - Fork 1
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
Use CLI flags parser from Icinga Go Library #231
Conversation
What is the benefit of doing this in |
The only benefit I had from doing this was that I didn't have to explicitly make an |
8793d85
to
6f77a45
Compare
6f77a45
to
ef68dc4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works as intended!
$ ./icinga-notifications --help
Usage:
icinga-notifications [OPTIONS]
Application Options:
--version print version and exit
-c, --config= path to config file (default: /etc/icinga-notifications/config.yml)
Help Options:
-h, --help Show this help message
$ ./icinga-notifications --version
Icinga Notifications version: 0.0.0-gef68dc4-dirty
Build information:
Go version: go1.22.5 (linux, amd64)
Git commit: ef68dc48715792b1bf7d069aca9b4bdde9542c81 (modified)
System information:
Platform: Red Star OS
Platform version: 4.0
$ ./icinga-notifications
can't open YAML file /etc/icinga-notifications/config.yml: open /etc/icinga-notifications/config.yml: no such file or directory
$ ./icinga-notifications -c /dev/null
can't parse YAML file /dev/null: EOF
$ ./icinga-notifications --config /dev/null
can't parse YAML file /dev/null: EOF
ef68dc4
to
a5ad434
Compare
a5ad434
to
bc74647
Compare
bc74647
to
6257a30
Compare
This PR replaces the manual parsing of the CLI flags with the CLI flags parser from our Icinga Go Library and cleans up the main function a bit. The flags are now parsed in
daemon.ParseFlagsAndConfig
function called from within main function and panics/exits when encountering unexpected inputs.Requires