@@ -16,6 +16,8 @@ import (
1616 "github.com/elastic/go-elasticsearch/v8/typedapi/types"
1717 "github.com/elastic/go-elasticsearch/v8/typedapi/types/enums/bytes"
1818 "github.com/olekukonko/tablewriter"
19+ "github.com/olekukonko/tablewriter/renderer"
20+ "github.com/olekukonko/tablewriter/tw"
1921 "github.com/urfave/cli/v3"
2022)
2123
@@ -30,6 +32,7 @@ func ilmList(ctx context.Context, cmd *cli.Command) error {
3032 minPriSizeStr := cmd .String ("min-pri-size" )
3133 minTotalSizeStr := cmd .String ("min-total-size" )
3234 minAge := time .Duration (cmd .Int ("min-age-days" )) * 24 * time .Hour
35+ format := cmd .String ("format" )
3336
3437 if ! isRegionValid (region ) {
3538 return fmt .Errorf ("region %q is not a known Elastic Cloud region" , region )
@@ -218,7 +221,29 @@ func ilmList(ctx context.Context, cmd *cli.Command) error {
218221 data = append (data , []string {item .name , item .phase , item .action , item .step , item .policy , formatDuration (item .age ), units .BytesSize (float64 (item .priSize )), units .BytesSize (float64 (item .totalSize ))})
219222 }
220223
221- table := tablewriter .NewWriter (os .Stdout )
224+ opts := []tablewriter.Option {
225+ tablewriter .WithRenderer (
226+ renderer .NewBlueprint (),
227+ ),
228+ }
229+ switch format {
230+ case "compact" :
231+ opts = []tablewriter.Option {
232+ tablewriter .WithRenderer (
233+ renderer .NewBlueprint (
234+ tw.Rendition {
235+ Borders : tw .BorderNone ,
236+ Settings : tw.Settings {
237+ Lines : tw .LinesNone ,
238+ Separators : tw .SeparatorsNone ,
239+ },
240+ },
241+ ),
242+ ),
243+ }
244+ }
245+
246+ table := tablewriter .NewTable (os .Stdout , opts ... )
222247 table .Header ([]string {
223248 "Index" , "Phase" , "Action" , "Step" , "Policy" , "Age" , "Pri Size" , "Total Size" ,
224249 })
0 commit comments