@@ -119,40 +119,42 @@ async function selectApp({
119119 ) ;
120120}
121121
122- export const appCommands = {
123- createApp : async ( {
124- options,
125- } : {
126- options : { name : string ; downloadUrl : string ; platform ?: Platform | '' } ;
127- } ) => {
128- const name = options . name || ( await question ( t ( 'appNameQuestion' ) ) ) ;
129- const { downloadUrl } = options ;
130- const platform = await getPlatform ( options . platform ) ;
131- const { id } = await post ( '/app/create' , { name, platform, downloadUrl } ) ;
132- console . log ( t ( 'createAppSuccess' , { id } ) ) ;
133- await selectApp ( {
134- args : [ String ( id ) ] ,
135- options : { platform } ,
136- } ) ;
137- } ,
138- deleteApp : async ( {
139- args,
140- options,
141- } : {
142- args : string [ ] ;
143- options : { platform : Platform } ;
144- } ) => {
145- const { platform } = options ;
146- const id = args [ 0 ] || ( await chooseApp ( platform ) ) . id ;
147- if ( ! id ) {
148- console . log ( t ( 'cancelled' ) ) ;
149- }
150- await doDelete ( `/app/${ id } ` ) ;
151- console . log ( t ( 'operationSuccess' ) ) ;
152- } ,
153- apps : async ( { options } : { options : { platform ?: Platform | '' } } ) => {
154- const { platform = '' } = options ;
155- await listApp ( platform ) ;
156- } ,
157- selectApp,
158- } ;
122+ export function getAppCommands ( ) {
123+ return {
124+ createApp : async ( {
125+ options,
126+ } : {
127+ options : { name : string ; downloadUrl : string ; platform ?: Platform | '' } ;
128+ } ) => {
129+ const name = options . name || ( await question ( t ( 'appNameQuestion' ) ) ) ;
130+ const { downloadUrl } = options ;
131+ const platform = await getPlatform ( options . platform ) ;
132+ const { id } = await post ( '/app/create' , { name, platform, downloadUrl } ) ;
133+ console . log ( t ( 'createAppSuccess' , { id } ) ) ;
134+ await selectApp ( {
135+ args : [ String ( id ) ] ,
136+ options : { platform } ,
137+ } ) ;
138+ } ,
139+ deleteApp : async ( {
140+ args,
141+ options,
142+ } : {
143+ args : string [ ] ;
144+ options : { platform : Platform } ;
145+ } ) => {
146+ const { platform } = options ;
147+ const id = args [ 0 ] || ( await chooseApp ( platform ) ) . id ;
148+ if ( ! id ) {
149+ console . log ( t ( 'cancelled' ) ) ;
150+ }
151+ await doDelete ( `/app/${ id } ` ) ;
152+ console . log ( t ( 'operationSuccess' ) ) ;
153+ } ,
154+ apps : async ( { options } : { options : { platform ?: Platform | '' } } ) => {
155+ const { platform = '' } = options ;
156+ await listApp ( platform ) ;
157+ } ,
158+ selectApp,
159+ } ;
160+ }
0 commit comments