mirror of
https://github.com/hanzo-fi/stack.git
synced 2026-10-30 20:34:43 +00:00
32 lines
988 B
Go
32 lines
988 B
Go
package views
|
|
|
|
import (
|
|
"github.com/formancehq/formance-sdk-go/pkg/models/shared"
|
|
"github.com/pterm/pterm"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func DisplayMangopayConfig(cmd *cobra.Command, connectorConfig *shared.ConnectorConfigResponse) error {
|
|
config := connectorConfig.Data.MangoPayConfig
|
|
|
|
tableData := pterm.TableData{}
|
|
tableData = append(tableData, []string{pterm.LightCyan("Name:"), config.Name})
|
|
tableData = append(tableData, []string{pterm.LightCyan("ClientID:"), config.ClientID})
|
|
tableData = append(tableData, []string{pterm.LightCyan("API key:"), config.APIKey})
|
|
tableData = append(tableData, []string{pterm.LightCyan("Endpoint:"), config.Endpoint})
|
|
tableData = append(tableData, []string{pterm.LightCyan("Polling Period:"), func() string {
|
|
if config.PollingPeriod == nil {
|
|
return ""
|
|
}
|
|
return *config.PollingPeriod
|
|
}()})
|
|
|
|
if err := pterm.DefaultTable.
|
|
WithWriter(cmd.OutOrStdout()).
|
|
WithData(tableData).
|
|
Render(); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|