Files
steampipe/pkg/display/variables.go
kaidaguerre fa18c8f0e2 Add support for node reuse. Update graph, flow and hierarchy to declare nodes and edges inline, rather than as a list of references. Closes #2871
Only top level resources can have with and param blocks. Closes #2872
Refactor resource and dashboard run hierarchies to use base impl structs. Closes #2873
2022-12-14 17:18:57 +00:00

26 lines
822 B
Go

package display
import (
"encoding/json"
"fmt"
"github.com/turbot/steampipe/pkg/error_helpers"
"github.com/turbot/steampipe/pkg/steampipeconfig/modconfig"
)
func ShowVarsListJson(vars []*modconfig.Variable) {
jsonOutput, err := json.MarshalIndent(vars, "", " ")
error_helpers.FailOnErrorWithMessage(err, "failed to marshal variables to JSON")
fmt.Println(string(jsonOutput))
}
func ShowVarsListTable(vars []*modconfig.Variable) {
headers := []string{"mod_name", "name", "description", "value", "value_default", "type"}
var rows = make([][]string, len(vars))
for i, v := range vars {
rows[i] = []string{v.ModName, v.ShortName, v.GetDescription(), fmt.Sprintf("%v", v.ValueGo), fmt.Sprintf("%v", v.DefaultGo), v.TypeString}
}
ShowWrappedTable(headers, rows, &ShowWrappedTableOptions{AutoMerge: false})
}