@@ -2,6 +2,8 @@ import { apiGetAction, Subcommand } from "../_helpers.ts";
22import { getConfig } from "../../config/index.ts" ;
33import { getRequestJSONList } from "../../api/index.ts" ;
44import { getLogger } from "../../util/logging.ts" ;
5+ import { funcError } from "../../util/errors.ts" ;
6+ import { RenderCLIError } from "../../errors.ts" ;
57
68const desc =
79`Lists the services this user can see.` ;
@@ -15,7 +17,7 @@ export const servicesListCommand =
1517 default : 'table' ,
1618 } )
1719 . option ( "--columns <cols:string[]>" , "if --format table, the columns to show." , {
18- default : [ 'id' , 'name' , 'type' , 'slug' , 'suspended ' ] ,
20+ default : [ 'id' , 'name' , 'type' , 'serviceDetails.env' , ' slug', 'serviceDetails.numInstances ' ] ,
1921 } )
2022 . group ( "API parameters" )
2123 . option ( "--name <name:string[]>" , "the name of a service to filter by" , { collect : true } )
@@ -27,6 +29,10 @@ export const servicesListCommand =
2729 . option ( "--created-after <datetime>" , "services created after (ISO8601)" )
2830 . option ( "--updated-before <datetime>" , "services updated before (ISO8601)" )
2931 . option ( "--updated-after <datetime>" , "services updated after (ISO8601)" )
32+ . group ( "API-nonstandard parameters" )
33+ . option ( "--suspended <susp:string>" , "'true'/'yes', 'false'/'no', or 'all'" , {
34+ default : 'false' ,
35+ } )
3036 . action ( ( opts ) => apiGetAction ( {
3137 format : opts . format ,
3238 tableColumns : opts . columns ,
@@ -44,6 +50,14 @@ export const servicesListCommand =
4450 type : opts . type ?. flat ( Infinity ) ,
4551 env : opts . env ?. flat ( Infinity ) ,
4652 region : opts . serviceRegion ?. flat ( Infinity ) ,
53+ suspended :
54+ opts . suspended === 'all'
55+ ? [ 'suspended' , 'not_suspended' ]
56+ : [ 'true' , 'yes' ] . includes ( opts . suspended . toLowerCase ( ) )
57+ ? [ 'suspended' ]
58+ : [ 'false' , 'no' ] . includes ( opts . suspended . toLowerCase ( ) )
59+ ? [ 'not_suspended' ]
60+ : funcError ( new RenderCLIError ( `invalid --suspended: ${ opts . suspended } ` ) ) ,
4761 createdBefore : opts . createdBefore ,
4862 createdAfter : opts . createdAfter ,
4963 updatedBefore : opts . updatedBefore ,
0 commit comments