diff --git a/app/cmd/config.go b/app/cmd/config.go index 78f566d73a0dfd9e49b22c239f91a4e9ed59b76d..7400c697f52b38534b1f28ad3f822ca0da32f937 100644 --- a/app/cmd/config.go +++ b/app/cmd/config.go @@ -7,6 +7,7 @@ import ( "os" "runtime" + "github.com/linuxsuren/jenkins-cli/util" "github.com/spf13/cobra" "gopkg.in/yaml.v2" ) @@ -41,14 +42,16 @@ var configCmd = &cobra.Command{ } if configOptions.List { - fmt.Println("number\tname\turl") + table := util.CreateTable(os.Stdout) + table.AddRow("number", "name", "url") for i, jenkins := range getConfig().JenkinsServers { name := jenkins.Name if name == current.Name { name = fmt.Sprintf("*%s", name) } - fmt.Printf("%d\t%s\t%s\n", i, name, jenkins.URL) + table.AddRow(fmt.Sprintf("%d", i), name, jenkins.URL) } + table.Render() } if configOptions.Generate {