-
Notifications
You must be signed in to change notification settings - Fork 10
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
add "plan" command #16
Conversation
@@ -60,6 +61,14 @@ func cmdCreateMigration(c *cli.Context) error { | |||
} | |||
|
|||
func cmdMigrationsUp(c *cli.Context) error { | |||
return runMigrations(c, !true) |
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.
why !true instead of false?
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.
looks nice
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.
:' )
@@ -139,6 +160,17 @@ func cmdMigrationsDown(c *cli.Context) error { | |||
return nil | |||
} | |||
|
|||
func largestWithOf(list []Migration) int { |
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.
largestWidthOf, not largestWithOf
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.
typo
reportError(mtx.stateProvider.Config(), "save state", err) | ||
return errAbort | ||
log.Printf("%s %-"+strconv.Itoa(prettyWidth)+"s (%s)\n", leadingTitle, pretty(each.Filename), each.Filename) | ||
if isLogOnly { |
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.
Extract to a func that accepts 1 param (isLogOnly)
will reduce the size of this function significantly maybe a runAll private function?
prettyWidth = len(pf) | ||
} | ||
} | ||
prettyWidth := largestWithOf(all) |
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.
Don't forget to rename this after renaming the function
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.
refactor tooling helps here
@@ -84,26 +93,38 @@ func cmdMigrationsUp(c *cli.Context) error { | |||
reportError(mtx.stateProvider.Config(), "up until stop", errors.New("No such migration file: "+stopAfter)) | |||
return errAbort | |||
} | |||
prettyWidth := largestWithOf(all) |
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.
largestWidthOf
note the D
No description provided.