mirror of
https://github.com/hanzo-fi/stack.git
synced 2026-10-30 20:34:43 +00:00
+ 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
29 lines
848 B
Go
29 lines
848 B
Go
package views
|
|
|
|
import (
|
|
"fmt"
|
|
"io"
|
|
|
|
fctl "github.com/formancehq/fctl/pkg"
|
|
"github.com/formancehq/formance-sdk-go/pkg/models/shared"
|
|
"github.com/pterm/pterm"
|
|
)
|
|
|
|
func PrintHold(out io.Writer, hold shared.ExpandedDebitHold) error {
|
|
fctl.Section.Println("Information")
|
|
tableData := pterm.TableData{}
|
|
tableData = append(tableData, []string{pterm.LightCyan("ID"), fmt.Sprint(hold.ID)})
|
|
tableData = append(tableData, []string{pterm.LightCyan("Wallet ID"), hold.WalletID})
|
|
tableData = append(tableData, []string{pterm.LightCyan("Original amount"), fmt.Sprint(hold.OriginalAmount)})
|
|
tableData = append(tableData, []string{pterm.LightCyan("Remaining"), fmt.Sprint(hold.Remaining)})
|
|
|
|
if err := pterm.DefaultTable.
|
|
WithWriter(out).
|
|
WithData(tableData).
|
|
Render(); err != nil {
|
|
return err
|
|
}
|
|
|
|
return fctl.PrintMetadata(out, hold.Metadata)
|
|
}
|