mirror of
https://github.com/opentffoundation/opentf.git
synced 2026-05-16 16:01:49 -04:00
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org> Signed-off-by: Christian Mesh <christianmesh1@gmail.com> Co-authored-by: Christian Mesh <christianmesh1@gmail.com>
27 lines
641 B
Go
27 lines
641 B
Go
// Copyright (c) The OpenTofu Authors
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
// Copyright (c) 2023 HashiCorp, Inc.
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
package views
|
|
|
|
import "github.com/opentofu/opentofu/internal/tfdiags"
|
|
|
|
// Root is the view that is meant to be used strictly during the initialisation of the process
|
|
// and offers methods to print errors as raw as possible.
|
|
type Root struct {
|
|
view *View
|
|
}
|
|
|
|
func NewRoot(view *View) *Root {
|
|
return &Root{view: view}
|
|
}
|
|
|
|
func (v *Root) Error(msg string) {
|
|
_, _ = v.view.streams.Eprintln(msg)
|
|
}
|
|
|
|
func (v *Root) Diagnostics(diagnostics tfdiags.Diagnostics) {
|
|
v.view.Diagnostics(diagnostics)
|
|
}
|