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

Rework of CLI + Cobra #69

Merged
merged 39 commits into from
Jun 5, 2021
Merged

Rework of CLI + Cobra #69

merged 39 commits into from
Jun 5, 2021

Conversation

Foxboron
Copy link
Owner

This is a massive and probably quite impossible to review properly. But lets try :)

This restructures most of the top-level cobra commands with the goal of having proper error propagation and seperation between user-facing interaction and keeping some sbctl functionality as a library.

All of the printing has been reworked. All errors are properly bubbled up, but some might not leave a user friendly error in main.go yet. Missing is propper debug logging infrastructure, and key generation/enrollment is left as-is because we are moving to go-uefi anyway.

Fixes #59
Fixes #62
Fixes #56

@Foxboron
Copy link
Owner Author

This is also missing proper flag grouping. For the sake of reference the inspiration for the layout has been taken from podman :)

https://github.com/containers/podman/blob/master/cmd/podman/containers/rm.go

@Foxboron
Copy link
Owner Author

It's also missing --json being a bit more granular. It's added to all commands and hides all prints by default, however not all commands have a json output yet.

util.go Outdated Show resolved Hide resolved
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Move more logic top-level, move prints to top-level

Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
return fmt.Errorf("couldn't initialize secure boot: %w", err)
}
} else {
logging.Ok("Secure boot keys has already been created!")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be fatal (and exit non-zero)?

@Foxboron Foxboron merged commit 5d528ff into master Jun 5, 2021
@Foxboron Foxboron deleted the morten/cli branch September 7, 2021 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Shell completions are corrupted. Replace log.Fatal with log.Panic? New CLI output format
3 participants