You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: output.go
    path of file: ./repos/terraform/internal/command/views
    
    the code of the file until where you have to start completion: // Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1

package views

import (
	"bytes"
	"encoding/json"
	"fmt"
	"sort"
	"strings"

	"github.com/zclconf/go-cty/cty"
	"github.com/zclconf/go-cty/cty/convert"
	ctyjson "github.com/zclconf/go-cty/cty/json"

	"github.com/hashicorp/terraform/internal/command/arguments"
	"github.com/hashicorp/terraform/internal/repl"
	"github.com/hashicorp/terraform/internal/states"
	"github.com/hashicorp/terraform/internal/tfdiags"
)

// The Output view renders either one or all outputs, depending on whether or
// not the name argument is empty.
type Output interface {
	Output(name string, outputs map[string]*states.OutputValue) tfdiags.Diagnostics
	Diagnostics(diags tfdiags.Diagnostics)
}

// NewOutput returns an initialized Output implementation for the given ViewType.
func NewOutput(vt arguments.ViewType, view *View) Output {
	switch vt {
	case arguments.ViewJSON:
		return &OutputJSON{view: view}
	case arguments.ViewRaw:
		return &OutputRaw{view: view}
	case arguments.ViewHuman:
		return &OutputHuman{view: view}
	default:
		panic(fmt.Sprintf("unknown view type %v", vt))
	}
}

// The OutputHuman implementation renders outputs in a format equivalent to HCL
// source. This uses the same formatting logic as in the console REPL.
type OutputHuman struct {
	view *View
}

var _ Output = (*OutputHuman)(nil)

func (v *OutputHuman) Output(name string, outputs map[string]*states.OutputValue) tfdiags.Diagnostics {
	var diags tfdiags.Diagnostics

	if len(outputs) == 0 {
		diags = diags.Append(noOutputsWarning())
		return diags
	}

	if name != "" {
		output, ok := outputs[name]
		if !ok {
		
    
func (v *OutputRaw) Output(name string, outputs map[string]*states.OutputValue) tfdiags.Diagnostics {
	var diags tfdiags.Diagnostics

	if len(outputs) == 0 {
		diags = diags.Append(noOutputsWarning())
		return diags
	}

	if name == "" {
		diags = diags.Append(fmt.Errorf("Raw output format is only supported for single outputs"))
		return diags
	}

	output, ok := outputs[name]
	if !ok {
		diags = diags.Append(missingOutputError(name))
		return diags
	}

	strV, err := convert.Convert(output.Value, cty.String)
	if err != nil {
		diags = diags.Append(tfdiags.Sourceless(
			tfdiags.Error,
			"Unsupported value for raw output",
			fmt.Sprintf(
				"The -raw option only supports strings, numbers, and boolean values, but output value %q is %s.\n\nUse the -json option for machine-readable representations of output values that have complex types.",
				name, output.Value.Type().FriendlyName(),
			),
		))
		return diags
	}
	if strV.IsNull() {
		diags = diags.Append(tfdiags.Sourceless(
			tfdiags.Error,
			"Unsupported value for raw output",
			fmt.Sprintf(
				"The value for output value %q is null, so -raw mode cannot print it.",
				name,
			),
		))
		return diags
	}
	if !strV.IsKnown() {
		// Since we're working with values from the state it would be very
		// odd to end up in here, but we'll handle it anyway to avoid a
		// panic in case our rules somehow change in future.
		diags = diags.Append(tfdiags.Sourceless(
			tfdiags.Error,
			"Unsupported value for raw output",
			fmt.Sprintf(
				"The value for output value %q won't be known until after a successful terraform apply, so -raw mode cannot print it.",
				name,
			),
		))
		return diags
	}
	// If we get out here then we should have a valid string to print.
	// We're writing it using Print here so that a shell caller will get
	// exactly the value and no extra whitespace (including trailing newline).
	v.view.streams.Print(strV.AsString())
	return nil
}