diff --git a/versioned_docs/version-1.2/how_to_guides/go_script.mdx b/versioned_docs/version-1.2/how_to_guides/go_script.mdx index 22808453..799bb2fc 100644 --- a/versioned_docs/version-1.2/how_to_guides/go_script.mdx +++ b/versioned_docs/version-1.2/how_to_guides/go_script.mdx @@ -24,12 +24,15 @@ func main() { args := []string{"repo", "ls", "mcr.microsoft.com"} cmd := root.New() cmd.SetArgs(args) + builder := &strings.Builder{} + cmd.SetOut(builder) fmt.Printf("Executing 'oras %s':", strings.Join(args, " ")) err := cmd.Execute() if err != nil { fmt.Errorf("Failed to execute : %w", err) os.Exit(-1) } + fmt.Println(builder.String()) os.Exit(0) } ```