Skip to content

Commit 609bf82

Browse files
Shu Kutsuzawatk3fftk
authored andcommitted
fix: Format get bp and banner get columns (#33)
* format column * to Camel Upper
1 parent 4f7d134 commit 609bf82

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

command/banner_get.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,12 @@ func (o *BannerGetOption) Run(cmd *cobra.Command, args []string) error {
4141
}
4242

4343
func (o *BannerGetOption) print(banners []sdapi.BannerResponse) {
44-
fmt.Fprintf(os.Stdout, "ID\tIsActive\tMessage\n")
44+
o.printColumn("ID", "IsActive", "Message")
4545
for _, b := range banners {
46-
fmt.Fprintf(os.Stdout, "%v\t%v\t%v\n", b.ID, b.IsActive, b.Message)
46+
o.printColumn(b.ID, b.IsActive, b.Message)
4747
}
4848
}
49+
50+
func (o *BannerGetOption) printColumn(id, isActive, msg interface{}) {
51+
fmt.Fprintf(os.Stdout, "%-8v%-12v%v\n", id, isActive, msg)
52+
}

pkg/sdapi/sdapi.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ func (sd *SDAPI) GetPipelinePageFromBuildID(buildID string) error {
329329
wg.Add(buildIDLength)
330330

331331
exit := make(chan error, buildIDLength)
332-
332+
fmt.Fprintf(os.Stdout, "%-80v%-15v\n", "BuildURL", "Repo (Job)")
333333
for _, b := range buildIDList {
334334
go func(b string) {
335335
defer wg.Done()
@@ -349,7 +349,9 @@ func (sd *SDAPI) GetPipelinePageFromBuildID(buildID string) error {
349349
exit <- err
350350
return
351351
}
352-
fmt.Println(basePipelineURL + strconv.Itoa(jr.PipelineID) + "/builds/" + b + "\t" + pr.SCMRepo.Name + "(" + jr.Name + ")")
352+
buildURL := fmt.Sprintf("%s%d/builds/%s", basePipelineURL, jr.PipelineID, b)
353+
repoJob := fmt.Sprintf("%s (%s)", pr.SCMRepo.Name, jr.Name)
354+
fmt.Fprintf(os.Stdout, "%-80v%-15v\n", buildURL, repoJob)
353355
}(b)
354356
}
355357

0 commit comments

Comments
 (0)