Skip to content

Commit

Permalink
cmd/atlas/internal/cmdapi: run upgrade suggestion in logic (#3024)
Browse files Browse the repository at this point in the history
  • Loading branch information
rotemtam authored Aug 6, 2024
1 parent 0caf6b6 commit f04ca30
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
6 changes: 0 additions & 6 deletions cmd/atlas/internal/cmdapi/cmdapi_oss.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ func init() {
schemaInspectCmd(),
unsupportedCommand("schema", "test"),
)
schemaCmd.PersistentPreRun = func(cmd *cobra.Command, _ []string) {
maySuggestUpgrade(cmd)
}
Root.AddCommand(schemaCmd)
migrateCmd := migrateCmd()
migrateCmd.AddCommand(
Expand All @@ -63,9 +60,6 @@ func init() {
unsupportedCommand("migrate", "push"),
unsupportedCommand("migrate", "test"),
)
migrateCmd.PersistentPreRun = func(cmd *cobra.Command, _ []string) {
maySuggestUpgrade(cmd)
}
Root.AddCommand(migrateCmd)
}

Expand Down
3 changes: 3 additions & 0 deletions cmd/atlas/internal/cmdapi/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ func schemaApplyRun(cmd *cobra.Command, flags schemaApplyFlags, env *Env) error
if err != nil {
return err
}
maySuggestUpgrade(cmd)
// Returning at this stage should
// not trigger the help message.
cmd.SilenceUsage = true
Expand Down Expand Up @@ -438,6 +439,7 @@ func schemaDiffRun(cmd *cobra.Command, _ []string, flags schemaDiffFlags, env *E
if err != nil {
return err
}
maySuggestUpgrade(cmd)
return format.Execute(cmd.OutOrStdout(),
cmdlog.NewSchemaDiff(ctx, c, diff.from, diff.to, diff.changes),
)
Expand Down Expand Up @@ -544,6 +546,7 @@ func schemaInspectRun(cmd *cobra.Command, _ []string, flags schemaInspectFlags,
if err != nil {
return err
}
maySuggestUpgrade(cmd)
return format.Execute(cmd.OutOrStdout(), cmdlog.NewSchemaInspect(ctx, client, s))
}

Expand Down

0 comments on commit f04ca30

Please sign in to comment.