Files
RAGOT DavidandGitHub 0df34a4d94 feat: fctl output=<json> (#363)
+ Add controller interface
+ Add renderable interface

- A controller define his store. And Running cycle returning a renderable interface
- Json is handle between Run & Render is the proper flag is set
2023-07-07 09:36:12 +02:00

27 lines
585 B
Go

package views
import (
"io"
fctl "github.com/formancehq/fctl/pkg"
"github.com/formancehq/formance-sdk-go/pkg/models/shared"
"github.com/pterm/pterm"
)
func PrintSecrets(out io.Writer, secrets []shared.ClientSecret) error {
fctl.Section.WithWriter(out).Println("Secrets :")
return pterm.DefaultTable.
WithWriter(out).
WithHasHeader(true).
WithData(fctl.Prepend(
fctl.Map(secrets, func(secret shared.ClientSecret) []string {
return []string{
secret.ID, secret.Name, secret.LastDigits,
}
}),
[]string{"ID", "Name", "Last digits"},
)).
Render()
}