diff --git a/cmd/uniflow/apply/cmd.go b/cmd/uniflow/apply/cmd.go index c1b28e17..a2b6f955 100644 --- a/cmd/uniflow/apply/cmd.go +++ b/cmd/uniflow/apply/cmd.go @@ -1,11 +1,13 @@ package apply import ( + "fmt" "io" "io/fs" "github.com/oklog/ulid/v2" "github.com/siyul-park/uniflow/cmd/flag" + "github.com/siyul-park/uniflow/cmd/printer" "github.com/siyul-park/uniflow/cmd/resource" "github.com/siyul-park/uniflow/internal/util" "github.com/siyul-park/uniflow/pkg/database" @@ -22,6 +24,31 @@ type ( } ) +var ( + SpecTableColumnDefinitions = []printer.TableColumnDefinition{ + { + Name: "id", + Format: "$.id", + }, + { + Name: "kind", + Format: "$.kind", + }, + { + Name: "name", + Format: "$.name", + }, + { + Name: "namespace", + Format: "$.namespace", + }, + { + Name: "links", + Format: "$.links", + }, + } +) + func NewCmd(config Config) *cobra.Command { sc := config.Scheme db := config.Database @@ -134,6 +161,19 @@ func NewCmd(config Config) *cobra.Command { return err } + tablePrinter, err := printer.NewTable(SpecTableColumnDefinitions) + if err != nil { + return err + } + + table, err := tablePrinter.Print(specs) + if err != nil { + return err + } + if _, err := fmt.Fprint(cmd.OutOrStdout(), table); err != nil { + return err + } + return nil }, }