-
-
Notifications
You must be signed in to change notification settings - Fork 121
Add "show-config" subcommand #698
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
base: main
Are you sure you want to change the base?
Conversation
|
Just wanted to let you know I will need some more time in order to do a proper review here. I'm very happy the PR is here in any case. |
|
No worries, frohe Weihnachten! btw I’m not too happy with the flag parsing, I think my implementation could be improved |
| } | ||
|
|
||
| for _, config := range configurations { | ||
| if config == nil { |
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.
can config ever be nil since there are many default values?
cmd/backup/main.go
Outdated
| c := newCommand() | ||
| if flag.Arg(0) == "show-config" { | ||
| c.must(runShowConfig()) | ||
| return |
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.
I think this should first check for an argument. If there is one there should be a switch with the default being an abort because an unknown flag was passed.
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.
And this logic could also live in its own file
18db772 to
13e54e1
Compare
Addresses #628
Approach
I looked into how shouterrr pretty-prints its verify function and tried to find the best poor-mans approach to it.
I wanted to add a little bit of formatting, because without any formatting, the output is pretty hard to read. So I landed on a basic regex based formatter.
I played around with coloring the output as well, but I ended up with a lot of code for a nice-to-have, so I removed it again.