@@ -439,6 +439,11 @@ var buildsCompare = cli.Command{
439439func handleBuildsCreate (ctx context.Context , cmd * cli.Command ) error {
440440 cc := getAPICommandContext (cmd )
441441
442+ unusedArgs := cmd .Args ().Slice ()
443+ if len (unusedArgs ) > 0 {
444+ return fmt .Errorf ("Unexpected extra arguments: %v" , unusedArgs )
445+ }
446+
442447 // Handle file flags by reading files and mutating JSON body
443448 if err := applyFileFlag (cmd , "openapi-spec" , "revision.openapi\\ .yml.content" ); err != nil {
444449 return err
@@ -459,7 +464,7 @@ func handleBuildsCreate(ctx context.Context, cmd *cli.Command) error {
459464 if err != nil {
460465 return err
461466 }
462-
467+
463468 buildGroup .Property ("build_id" , res .ID )
464469
465470 if cmd .Bool ("wait" ) {
@@ -483,12 +488,22 @@ func handleBuildsCreate(ctx context.Context, cmd *cli.Command) error {
483488 }
484489 }
485490
491+ data := gjson .Parse (string (res .RawJSON ()))
486492 format := cmd .Root ().String ("format" )
487- return ShowJSON ("builds create" , res .RawJSON (), format )
493+ transform := cmd .Root ().String ("transform" )
494+ return ShowJSON ("builds create" , data , format , transform )
488495}
489496
490497func handleBuildsRetrieve (ctx context.Context , cmd * cli.Command ) error {
491498 cc := getAPICommandContext (cmd )
499+ unusedArgs := cmd .Args ().Slice ()
500+ if ! cmd .IsSet ("build-id" ) && len (unusedArgs ) > 0 {
501+ cmd .Set ("build-id" , unusedArgs [0 ])
502+ unusedArgs = unusedArgs [1 :]
503+ }
504+ if len (unusedArgs ) > 0 {
505+ return fmt .Errorf ("Unexpected extra arguments: %v" , unusedArgs )
506+ }
492507 var res []byte
493508 _ , err := cc .client .Builds .Get (
494509 context .TODO (),
@@ -500,8 +515,10 @@ func handleBuildsRetrieve(ctx context.Context, cmd *cli.Command) error {
500515 return err
501516 }
502517
518+ json := gjson .Parse (string (res ))
503519 format := cmd .Root ().String ("format" )
504- return ShowJSON ("builds retrieve" , string (res ), format )
520+ transform := cmd .Root ().String ("transform" )
521+ return ShowJSON ("builds retrieve" , json , format , transform )
505522}
506523
507524// pullBuildOutputs pulls the outputs for a completed build
@@ -775,6 +792,10 @@ func pullOutput(output, url, ref, targetDir string, targetGroup *Group) error {
775792
776793func handleBuildsList (ctx context.Context , cmd * cli.Command ) error {
777794 cc := getAPICommandContext (cmd )
795+ unusedArgs := cmd .Args ().Slice ()
796+ if len (unusedArgs ) > 0 {
797+ return fmt .Errorf ("Unexpected extra arguments: %v" , unusedArgs )
798+ }
778799 params := stainless.BuildListParams {}
779800 var res []byte
780801 _ , err := cc .client .Builds .List (
@@ -787,12 +808,18 @@ func handleBuildsList(ctx context.Context, cmd *cli.Command) error {
787808 return err
788809 }
789810
811+ json := gjson .Parse (string (res ))
790812 format := cmd .Root ().String ("format" )
791- return ShowJSON ("builds list" , string (res ), format )
813+ transform := cmd .Root ().String ("transform" )
814+ return ShowJSON ("builds list" , json , format , transform )
792815}
793816
794817func handleBuildsCompare (ctx context.Context , cmd * cli.Command ) error {
795818 cc := getAPICommandContext (cmd )
819+ unusedArgs := cmd .Args ().Slice ()
820+ if len (unusedArgs ) > 0 {
821+ return fmt .Errorf ("Unexpected extra arguments: %v" , unusedArgs )
822+ }
796823 params := stainless.BuildCompareParams {}
797824 var res []byte
798825 _ , err := cc .client .Builds .Compare (
@@ -805,6 +832,8 @@ func handleBuildsCompare(ctx context.Context, cmd *cli.Command) error {
805832 return err
806833 }
807834
835+ json := gjson .Parse (string (res ))
808836 format := cmd .Root ().String ("format" )
809- return ShowJSON ("builds compare" , string (res ), format )
837+ transform := cmd .Root ().String ("transform" )
838+ return ShowJSON ("builds compare" , json , format , transform )
810839}
0 commit comments