From 78c2a695191d6e9e383240eb6fe9036013fef16e Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 18 Mar 2026 12:34:53 +0100 Subject: [PATCH] cmd/cli/commands: use local fork of hooks.PrintNextSteps We're refactoring code in the CLI for better separation of plugin-manager and plugin code; add a local fork of this utility instead of depending on the utility in the CLI. Signed-off-by: Sebastiaan van Stijn --- cmd/cli/commands/status.go | 3 +-- cmd/cli/commands/status_test.go | 3 +-- cmd/cli/commands/utils.go | 19 ++++++++++++++++--- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/cmd/cli/commands/status.go b/cmd/cli/commands/status.go index f08f564cb..4301a0d65 100644 --- a/cmd/cli/commands/status.go +++ b/cmd/cli/commands/status.go @@ -9,7 +9,6 @@ import ( "sort" "strconv" - "github.com/docker/cli/cli-plugins/hooks" "github.com/docker/model-runner/cmd/cli/commands/completion" "github.com/docker/model-runner/cmd/cli/desktop" "github.com/docker/model-runner/cmd/cli/pkg/standalone" @@ -63,7 +62,7 @@ func textStatus(cmd *cobra.Command, status desktop.Status, backendStatus map[str cmd.Print(backendStatusTable(backendStatus)) } else { cmd.Println("Docker Model Runner is not running") - hooks.PrintNextSteps(cmd.OutOrStdout(), []string{enableViaCLI, enableViaGUI}) + printNextSteps(cmd.OutOrStdout(), []string{enableViaCLI, enableViaGUI}) osExit(1) } } diff --git a/cmd/cli/commands/status_test.go b/cmd/cli/commands/status_test.go index 47b1254db..9a53d8101 100644 --- a/cmd/cli/commands/status_test.go +++ b/cmd/cli/commands/status_test.go @@ -10,7 +10,6 @@ import ( "strings" "testing" - "github.com/docker/cli/cli-plugins/hooks" "github.com/docker/model-runner/cmd/cli/desktop" mockdesktop "github.com/docker/model-runner/cmd/cli/mocks" "github.com/docker/model-runner/cmd/cli/pkg/standalone" @@ -51,7 +50,7 @@ func TestStatus(t *testing.T) { expectedOutput: func() string { buf := new(bytes.Buffer) fmt.Fprintln(buf, "Docker Model Runner is not running") - hooks.PrintNextSteps(buf, []string{enableViaCLI, enableViaGUI}) + printNextSteps(buf, []string{enableViaCLI, enableViaGUI}) return buf.String() }(), }, diff --git a/cmd/cli/commands/utils.go b/cmd/cli/commands/utils.go index c77f472b7..643955fc3 100644 --- a/cmd/cli/commands/utils.go +++ b/cmd/cli/commands/utils.go @@ -8,7 +8,6 @@ import ( "os" "strings" - "github.com/docker/cli/cli-plugins/hooks" "github.com/docker/model-runner/cmd/cli/desktop" "github.com/docker/model-runner/cmd/cli/pkg/standalone" "github.com/docker/model-runner/pkg/distribution/oci/reference" @@ -47,12 +46,12 @@ func handleClientError(err error, message string) error { if errors.Is(err, desktop.ErrServiceUnavailable) { err = errNotRunning var buf bytes.Buffer - hooks.PrintNextSteps(&buf, []string{enableViaCLI, enableViaGUI}) + printNextSteps(&buf, []string{enableViaCLI, enableViaGUI}) return fmt.Errorf("%w\n%s", err, strings.TrimRight(buf.String(), "\n")) } else if strings.Contains(err.Error(), vllm.ErrorNotFound.Error()) { // Handle `run` error. var buf bytes.Buffer - hooks.PrintNextSteps(&buf, []string{enableVLLM}) + printNextSteps(&buf, []string{enableVLLM}) return fmt.Errorf("%w\n%s", err, strings.TrimRight(buf.String(), "\n")) } return fmt.Errorf("%s: %w", message, err) @@ -270,3 +269,17 @@ func newTable(w io.Writer) *tablewriter.Table { }), ) } + +func printNextSteps(out io.Writer, messages []string) { + if len(messages) == 0 { + return + } + _, _ = fmt.Fprintln(out, bold("\nWhat's next:")) + for _, n := range messages { + _, _ = fmt.Fprintln(out, " ", n) + } +} + +func bold(s string) string { + return "\033[1m" + s + "\033[0m" +}