Skip to content

Commit 5bb5409

Browse files
authored
Increase default col max width to 50, make cfg (#215)
1 parent 30dae7a commit 5bb5409

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

internal/pkg/output/output_handler.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,18 +130,23 @@ func (o *OutputHandler) Table(cmd *cobra.Command, d interface{}) error {
130130
symbols = tw.NewSymbols(tw.StyleASCII)
131131
}
132132

133+
colMaxWidth := config.GetInt("output.table.column_max_width")
134+
if colMaxWidth <= 0 {
135+
colMaxWidth = 50
136+
}
137+
133138
table := tablewriter.NewTable(os.Stdout,
134139
tablewriter.WithHeaderAlignment(tw.AlignCenter),
135140
tablewriter.WithRowAlignment(tw.AlignLeft),
136141
tablewriter.WithRenderer(renderer.NewBlueprint(tw.Rendition{Symbols: symbols})),
137142
tablewriter.WithConfig(tablewriter.Config{
138143
Row: tw.CellConfig{
139144
Formatting: tw.CellFormatting{AutoWrap: tw.WrapNormal},
140-
ColMaxWidths: tw.CellWidth{Global: 30},
145+
ColMaxWidths: tw.CellWidth{Global: colMaxWidth},
141146
},
142147
Header: tw.CellConfig{
143148
Formatting: tw.CellFormatting{AutoWrap: tw.WrapNormal},
144-
ColMaxWidths: tw.CellWidth{Global: 30},
149+
ColMaxWidths: tw.CellWidth{Global: colMaxWidth},
145150
},
146151
}))
147152

0 commit comments

Comments
 (0)