@@ -9,6 +9,7 @@ import { processArgument } from "@cloudflare/cli/args";
99import { dim , gray } from "@cloudflare/cli/colors" ;
1010import { inputPrompt , spinner } from "@cloudflare/cli/interactive" ;
1111import { ApiError , ApplicationsService } from "@cloudflare/containers-shared" ;
12+ import YAML from "yaml" ;
1213import { wrap } from "../cloudchamber/helpers/wrap" ;
1314import { UserError } from "../errors" ;
1415import { isNonInteractiveOrCI } from "../is-interactive" ;
@@ -116,10 +117,9 @@ export async function infoCommand(
116117 ) ;
117118 }
118119
119- const details = flatDetails ( application ) ;
120120 const applicationDetails = {
121121 label : `${ application . name } (${ application . created_at } )` ,
122- details : details ,
122+ details : YAML . stringify ( application ) . split ( "\n" ) ,
123123 value : application . id ,
124124 } ;
125125 await inputPrompt ( {
@@ -147,29 +147,6 @@ export async function listCommand(
147147 await listCommandHandle ( listArgs , config ) ;
148148}
149149
150- function flatDetails < T extends Record < string , unknown > > (
151- obj : T ,
152- indentLevel = 0
153- ) : string [ ] {
154- const indent = " " . repeat ( indentLevel ) ;
155- return Object . entries ( obj ) . reduce < string [ ] > ( ( acc , [ key , value ] ) => {
156- if (
157- value !== undefined &&
158- value !== null &&
159- typeof value === "object" &&
160- ! Array . isArray ( value )
161- ) {
162- acc . push ( `${ indent } ${ key } :` ) ;
163- acc . push (
164- ...flatDetails ( value as Record < string , unknown > , indentLevel + 1 )
165- ) ;
166- } else if ( value !== undefined ) {
167- acc . push ( `${ indent } ${ key } : ${ value } ` ) ;
168- }
169- return acc ;
170- } , [ ] ) ;
171- }
172-
173150async function listCommandHandle (
174151 _args : StrictYargsOptionsToInterface < typeof listYargs > ,
175152 _config : Config
@@ -202,10 +179,9 @@ async function listCommandHandle(
202179 }
203180
204181 const applicationDetails = ( a : Application ) => {
205- const details = flatDetails ( a ) ;
206182 return {
207183 label : `${ a . name } (${ a . created_at } )` ,
208- details : details ,
184+ details : YAML . stringify ( a ) . split ( "\n" ) ,
209185 value : a . id ,
210186 } ;
211187 } ;
0 commit comments