-
Notifications
You must be signed in to change notification settings - Fork 157
migrate from urfave/cli to spf13/cobra #1954
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
Conversation
b1caa52 to
65598d3
Compare
|
There is still an issue with the output of the subcommand usage from Update: dde1a43 fixes the issue |
8178185 to
22857e0
Compare
| restart, _ := cmd.Flags().GetBool("restart") | ||
| var ev events.Unmarshaller | ||
| switch { | ||
| case c.Bool("retrigger"): |
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.
how did this ever work? the flag was registered as restart
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.
w00t 👀
Signed-off-by: Christian Richter <c.richter@opencloud.eu>
Signed-off-by: Christian Richter <c.richter@opencloud.eu>
Signed-off-by: Christian Richter <c.richter@opencloud.eu>
Signed-off-by: Christian Richter <c.richter@opencloud.eu>
Signed-off-by: Christian Richter <c.richter@opencloud.eu>
Signed-off-by: Christian Richter <c.richter@opencloud.eu>
Signed-off-by: Christian Richter <c.richter@opencloud.eu>
Signed-off-by: Christian Richter <c.richter@opencloud.eu>
Signed-off-by: Christian Richter <c.richter@opencloud.eu>
Signed-off-by: Christian Richter <c.richter@opencloud.eu>
Signed-off-by: Christian Richter <c.richter@opencloud.eu>
Signed-off-by: Christian Richter <c.richter@opencloud.eu>
Signed-off-by: Christian Richter <c.richter@opencloud.eu>
Signed-off-by: Christian Richter <c.richter@opencloud.eu>
Signed-off-by: Christian Richter <c.richter@opencloud.eu>
Signed-off-by: Christian Richter <c.richter@opencloud.eu>
Signed-off-by: Christian Richter <c.richter@opencloud.eu>
Signed-off-by: Christian Richter <c.richter@opencloud.eu>
Signed-off-by: Christian Richter <c.richter@opencloud.eu>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
We have replaced urfave/cli by spf13/cobra, because urfave had issues with race conditions and we could not fix them.
Hints for reviewers:
the PR is huge, but not that huge ("only" 5k lines of change, most of it duplicate refactorings, the rest ist vendoring from
spf13/cobra,spf13/viperandspf13/pflagno business logic has been touched)displaying help of consumed service commands is tricky, I replace the
RunEfunction in case there is none to make sure that the help is displayed, if the function already has aRunEfunction, it might be needed to addcmd.Help()there. (replace function: https://github.com/dragonchaser/opencloud/blob/22857e0cdc264701db0fc937b4ef2e595d3f8cd8/opencloud/pkg/command/root.go#L26-L36)TODO:
make test-with-raceci hickups... there are actual race conditionsRequired: truein urfave/cli commands are migrated to cobra like:fix Flag("...").Value calls and use type safe cobra substitution,
cmd.Flags().GetBool("..."), ...i think I replaced all.... but just make sure
trigger docs team to update docs, because https://github.com/dragonchaser/opencloud/blob/22857e0cdc264701db0fc937b4ef2e595d3f8cd8/opencloud/pkg/command/init.go#L44-L86 the shorthand commands have changed (background: cobra only supports single character shorthands, urfave multi-char shorthands)
oc initcommand can not be interrupted withctrl+cwhen running interactively without parametersmake
cmd.Context()in cobra inherit from the commands context to accept ctrl+c