myxce/src/frontend/xcecli/common/output/output_clusters.go
Rongsong Shen 3615c7c0fb
style(frontend): gofmt the apiserver and xcecli sources
Formatting only (gofmt -w on the 29 non-vendored, non-generated files
gofmt -l reported); swag-generated apiserver/docs/docs.go left as is.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-02 09:33:16 +00:00

45 lines
1 KiB
Go
Executable file

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)
}