Documentation ¶
Index ¶
- func GetCurrentReleaseTag(repo string) (string, error)
- func GetLatestReleaseTag(repoURL string) (string, error)
- func IsFarmUpdateRequired(cmd *cobra.Command, args []string)
- func OutFormatForList(out io.Writer) *tablewriter.Table
- func SetCurrentFarmVersion(version *db.FarmRelease)
- type OutputFormatter
- type Release
- type UpdateInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCurrentReleaseTag ¶
func GetLatestReleaseTag ¶
func IsFarmUpdateRequired ¶
func OutFormatForList ¶
func OutFormatForList(out io.Writer) *tablewriter.Table
OutFormatForList This configures the table format for the List commands
func SetCurrentFarmVersion ¶
func SetCurrentFarmVersion(version *db.FarmRelease)
SetCurrentVersion sets the current version of farm repo in DB
Types ¶
type OutputFormatter ¶
type OutputFormatter[T1, T2 any] struct { Writer io.Writer // Writer to write the output to Data T1 // Data to be formatted RowHeaders []string // Headers for table rows Array func(T1) []T2 // Function to convert Data into an array of T2 Row func(T2) []string // Function to convert each T2 into a row of strings }
OutputFormatter is a generic struct that takes two types T1 and T2. It is used for formatting output data either as JSON or as a table.
func (OutputFormatter[T1, T2]) WriteJson ¶
func (f OutputFormatter[T1, T2]) WriteJson() error
WriteJson formats the Data as JSON and writes it to the Writer.
func (OutputFormatter[T1, T2]) WriteJsonOrTable ¶
func (f OutputFormatter[T1, T2]) WriteJsonOrTable(isJson bool) error
WriteJsonOrTable decides whether to write Data as JSON or as a table based on the isJson flag.
func (OutputFormatter[T1, T2]) WriteTable ¶
func (f OutputFormatter[T1, T2]) WriteTable() error
WriteTable formats the Data as a table and writes it to the Writer.
type UpdateInfo ¶
Click to show internal directories.
Click to hide internal directories.