@@ -3,8 +3,6 @@ package pkg
33import (
44 "encoding/json"
55 "fmt"
6- "github.com/jenkins-zh/jenkins-cli/app/i18n"
7- "github.com/jenkins-zh/jenkins-cli/util"
86 "github.com/spf13/cobra"
97 "gopkg.in/yaml.v2"
108 "io"
@@ -76,7 +74,7 @@ func (o *OutputOption) OutputV2(obj interface{}) (err error) {
7674 case YAMLOutputFormat :
7775 data , err = yaml .Marshal (obj )
7876 case TableOutputFormat , "" :
79- table := util . CreateTableWithHeader (o .Writer , o .WithoutHeaders )
77+ table := CreateTableWithHeader (o .Writer , o .WithoutHeaders )
8078 table .AddHeader (strings .Split (o .Columns , "," )... )
8179 items := reflect .ValueOf (obj )
8280 for i := 0 ; i < items .Len (); i ++ {
@@ -122,7 +120,7 @@ func (o *OutputOption) Match(item reflect.Value) bool {
122120 key := arr [0 ]
123121 val := arr [1 ]
124122
125- if ! strings .Contains (util . ReflectFieldValueAsString (item , key ), val ) {
123+ if ! strings .Contains (ReflectFieldValueAsString (item , key ), val ) {
126124 return false
127125 }
128126 }
@@ -139,7 +137,7 @@ func (o *OutputOption) GetLine(obj reflect.Value) []string {
139137 }
140138
141139 for _ , col := range columns {
142- cell := util . ReflectFieldValueAsString (obj , col )
140+ cell := ReflectFieldValueAsString (obj , col )
143141 if renderCell , ok := o .CellRenderMap [col ]; ok && renderCell != nil {
144142 cell = renderCell (cell )
145143 }
@@ -153,16 +151,16 @@ func (o *OutputOption) GetLine(obj reflect.Value) []string {
153151// Deprecated, see also SetFlagWithHeaders
154152func (o * OutputOption ) SetFlag (cmd * cobra.Command ) {
155153 cmd .Flags ().StringVarP (& o .Format , "output" , "o" , TableOutputFormat ,
156- i18n . T ( "Format the output, supported formats: table, json, yaml" ) )
154+ "Format the output, supported formats: table, json, yaml" )
157155 cmd .Flags ().BoolVarP (& o .WithoutHeaders , "no-headers" , "" , false ,
158- i18n . T ( `When using the default output format, don't print headers (default print headers)` ) )
156+ `When using the default output format, don't print headers (default print headers)` )
159157 cmd .Flags ().StringArrayVarP (& o .Filter , "filter" , "" , []string {},
160- i18n . T ( "Filter for the list by fields" ) )
158+ "Filter for the list by fields" )
161159}
162160
163161// SetFlagWithHeaders set the flags of output
164162func (o * OutputOption ) SetFlagWithHeaders (cmd * cobra.Command , headers string ) {
165163 o .SetFlag (cmd )
166164 cmd .Flags ().StringVarP (& o .Columns , "columns" , "" , headers ,
167- i18n . T ( "The columns of table" ) )
165+ "The columns of table" )
168166}
0 commit comments