-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
General refactor of the cmd package #3328
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
Codecov Report
@@ Coverage Diff @@
## master #3328 +/- ##
==========================================
+ Coverage 35.05% 35.06% +<.01%
==========================================
Files 280 281 +1
Lines 40565 40559 -6
==========================================
Hits 14221 14221
+ Misses 24241 24235 -6
Partials 2103 2103
Continue to review full report at Codecov.
|
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.
LGTM, other than the ctx->c rename
} | ||
|
||
var priv interface{} | ||
var err error | ||
switch ctx.String("ecdsa-curve") { | ||
switch c.String("ecdsa-curve") { |
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.
rename of ctx
to c
just makes the code less readable, please change back
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 would generally agree, however the entire package refers to c *cli.Context instead of ctx *cli.Context. Shall I change everything to use ctx?
cmd/admin.go
Outdated
return fmt.Errorf("Password is not specified") | ||
} else if !c.IsSet("email") { | ||
return fmt.Errorf("Email is not specified") | ||
if err := argsSet(c, "username", "password"); err != 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.
This is breaking change and also (name -> username) and also is missing email check
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.
Wooops, looks like I forgot to edit after copypasting - nice catch! (good thing there are code reviews 😌)
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.
Otherwise Good
cmd/admin.go
Outdated
|
||
// argsSet checks that all the required arguments are set. args is a list of | ||
// arguments that must be set in the passed Context. | ||
func argsSet(c *cli.Context, args ...string) error { |
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'd move these two functions into cmd/common.go
or similar
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.
Done
@bkcsoft needs your approval |
Mostly some refactoring and removing of spaghetti code - nothing major.