Use new table formatter everywhere (#3544)

This commit is contained in:
Dean Sheather
2022-08-19 02:41:00 +10:00
committed by GitHub
parent c43297937b
commit 3610402cd8
13 changed files with 199 additions and 198 deletions

View File

@ -7,6 +7,7 @@ import (
"github.com/spf13/cobra"
"golang.org/x/xerrors"
"github.com/coder/coder/cli/cliui"
"github.com/coder/coder/codersdk"
)
@ -70,11 +71,16 @@ func parameterList() *cobra.Command {
return xerrors.Errorf("fetch params: %w", err)
}
_, err = fmt.Fprintln(cmd.OutOrStdout(), displayParameters(columns, params...))
out, err := cliui.DisplayTable(params, "name", columns)
if err != nil {
return xerrors.Errorf("render table: %w", err)
}
_, err = fmt.Fprintln(cmd.OutOrStdout(), out)
return err
},
}
cmd.Flags().StringArrayVarP(&columns, "column", "c", []string{"name", "scope", "destination_scheme"},
cmd.Flags().StringArrayVarP(&columns, "column", "c", []string{"name", "scope", "destination scheme"},
"Specify a column to filter in the table.")
return cmd
}