55 "fmt"
66
77 "github.com/MakeNowJust/heredoc"
8- "github.com/cli/go-gh/v2/pkg/tableprinter "
8+ "github.com/olekukonko/tablewriter "
99 "github.com/spf13/cobra"
1010
1111 "vonage-cloud-runtime-cli/pkg/cmdutil"
@@ -49,7 +49,6 @@ func NewCmdAppList(f cmdutil.Factory) *cobra.Command {
4949
5050func runList (ctx context.Context , opts * Options ) error {
5151 io := opts .IOStreams ()
52- c := io .ColorScheme ()
5352
5453 spinner := cmdutil .DisplaySpinnerMessageWithHandle (" Fetching applications list..." )
5554 apps , err := opts .DeploymentClient ().ListVonageApplications (ctx , opts .Filter )
@@ -58,18 +57,14 @@ func runList(ctx context.Context, opts *Options) error {
5857 return fmt .Errorf ("failed to list Vonage applications: %w" , err )
5958 }
6059
61- tp := tableprinter .New (io .Out , io .IsStdoutTTY (), 0 )
62- tp .AddField (c .Bold ("ID" ), nil , nil )
63- tp .AddField (c .Bold ("Name" ), nil , nil )
64- tp .EndRow ()
60+ table := tablewriter .NewWriter (io .Out )
61+ table .SetHeader ([]string {"ID" , "Name" })
62+
6563 for _ , app := range apps .Applications {
66- tp .AddField (app .ID , nil , nil )
67- tp .AddField (app .Name , nil , nil )
68- tp .EndRow ()
64+ table .Append ([]string {app .ID , app .Name })
6965 }
7066
71- if err := tp .Render (); err != nil {
72- return fmt .Errorf ("error rending applications list: %w" , err )
73- }
67+ // Render the table
68+ table .Render ()
7469 return nil
7570}
0 commit comments