@@ -4,8 +4,6 @@ package cmd
44
55import (
66 "context"
7- "fmt"
8- "os"
97
108 "github.com/stainless-api/stainless-api-cli/pkg/jsonflag"
119 "github.com/stainless-api/stainless-api-go"
@@ -140,8 +138,8 @@ func handleProjectsBranchesCreate(ctx context.Context, cmd *cli.Command) error {
140138 return err
141139 }
142140
143- fmt . Printf ( "%s \n " , ColorizeJSON ( res . RawJSON (), os . Stdout ) )
144- return nil
141+ format := cmd . Root (). String ( "format" )
142+ return ShowJSON ( "projects:branches create" , res . RawJSON (), format )
145143}
146144
147145func handleProjectsBranchesRetrieve (ctx context.Context , cmd * cli.Command ) error {
@@ -160,8 +158,8 @@ func handleProjectsBranchesRetrieve(ctx context.Context, cmd *cli.Command) error
160158 return err
161159 }
162160
163- fmt . Printf ( "%s \n " , ColorizeJSON ( res . RawJSON (), os . Stdout ) )
164- return nil
161+ format := cmd . Root (). String ( "format" )
162+ return ShowJSON ( "projects:branches retrieve" , res . RawJSON (), format )
165163}
166164
167165func handleProjectsBranchesList (ctx context.Context , cmd * cli.Command ) error {
@@ -179,8 +177,8 @@ func handleProjectsBranchesList(ctx context.Context, cmd *cli.Command) error {
179177 return err
180178 }
181179
182- fmt . Printf ( "%s \n " , ColorizeJSON ( res . RawJSON (), os . Stdout ) )
183- return nil
180+ format := cmd . Root (). String ( "format" )
181+ return ShowJSON ( "projects:branches list" , res . RawJSON (), format )
184182}
185183
186184func handleProjectsBranchesDelete (ctx context.Context , cmd * cli.Command ) error {
@@ -201,8 +199,8 @@ func handleProjectsBranchesDelete(ctx context.Context, cmd *cli.Command) error {
201199 return err
202200 }
203201
204- fmt . Printf ( "%s \n " , ColorizeJSON ( string ( res ), os . Stdout ) )
205- return nil
202+ format := cmd . Root (). String ( "format" )
203+ return ShowJSON ( "projects:branches delete" , string ( res ), format )
206204}
207205
208206func handleProjectsBranchesRebase (ctx context.Context , cmd * cli.Command ) error {
@@ -221,6 +219,6 @@ func handleProjectsBranchesRebase(ctx context.Context, cmd *cli.Command) error {
221219 return err
222220 }
223221
224- fmt . Printf ( "%s \n " , ColorizeJSON ( res . RawJSON (), os . Stdout ) )
225- return nil
222+ format := cmd . Root (). String ( "format" )
223+ return ShowJSON ( "projects:branches rebase" , res . RawJSON (), format )
226224}
0 commit comments