mirror of
https://github.com/turbot/steampipe.git
synced 2026-02-17 19:00:12 -05:00
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
26 lines
822 B
Go
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})
|
|
}
|