mirror of
https://github.com/turbot/steampipe.git
synced 2026-02-19 16:00:13 -05:00
26 lines
764 B
Go
26 lines
764 B
Go
package display
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
|
|
"github.com/turbot/steampipe/pkg/steampipeconfig/modconfig"
|
|
"github.com/turbot/steampipe/pkg/utils"
|
|
)
|
|
|
|
func ShowVarsListJson(vars []*modconfig.Variable) {
|
|
jsonOutput, err := json.MarshalIndent(vars, "", " ")
|
|
utils.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.Description, fmt.Sprintf("%v", v.ValueGo), fmt.Sprintf("%v", v.DefaultGo), v.TypeString}
|
|
}
|
|
ShowWrappedTable(headers, rows, false)
|
|
}
|