Merge Go frontend (apiserver + xcecli) into meson build

This commit is contained in:
Rongsong Shen 2026-04-14 11:20:17 +08:00
parent 43dc12a36c
commit c9dc8c4676
205 changed files with 30793 additions and 328 deletions

View file

@ -0,0 +1,45 @@
package output
import (
"fmt"
"os"
"text/tabwriter"
"xcecli/models"
)
type Output struct {
fields string
formatJson bool
noheader bool
verbose bool
wideFormat bool
jobStatusFilter []string
}
func NewOutput(fields string, formatJson bool, noheader bool) *Output {
return &Output{fields: fields, formatJson: formatJson, noheader: noheader}
}
func (o *Output) SetVerbose(verbose bool) {
o.verbose = verbose
}
func (o *Output) SetNoHeader(noheader bool) {
o.noheader = noheader
}
func (o *Output) SetWideFormat(wideFormat bool) {
o.wideFormat = wideFormat
}
func (o *Output) ClusterPrintData(cluster *models.ClusterInfo) {
printClustersVerboseOutput(cluster)
}
func printClustersVerboseOutput(clusters *models.ClusterInfo) {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', 0)
defer w.Flush()
fmt.Fprintf(w, "XCE Standard Cluster\t%s\t%s\n", clusters.Version, "Jul 08 2025")
fmt.Fprintf(w, "My cluster name: <%s>\n", clusters.ClusterName)
fmt.Fprintf(w, "The cluster status: <%s>\n", clusters.Status)
}