File tree Expand file tree Collapse file tree 1 file changed +16
-13
lines changed
packages/api/src/cli/commands Expand file tree Collapse file tree 1 file changed +16
-13
lines changed Original file line number Diff line number Diff line change 2626 'ts' ,
2727 ] )
2828 )
29- . action ( async ( uri : string , options : { lang : string } ) => {
29+ . addOption ( new Option ( '-y, --yes' , 'Automatically answer "yes" to any prompts printed' ) )
30+ . action ( async ( uri : string , options : { lang : string ; yes ?: boolean } ) => {
3031 let language : SupportedLanguages ;
3132 if ( options . lang ) {
3233 language = options . lang as SupportedLanguages ;
@@ -155,18 +156,20 @@ cmd
155156 logger ( ` ${ figures . pointerSmall } ${ pkg } : ${ pkgInfo . reason } ${ pkgInfo . url } ` ) ;
156157 } ) ;
157158
158- await promptTerminal ( {
159- type : 'confirm' ,
160- name : 'value' ,
161- message : 'OK to proceed with package installation?' ,
162- initial : true ,
163- } ) . then ( ( { value } ) => {
164- if ( ! value ) {
165- // @todo cleanup installed files
166- logger ( 'Installation cancelled.' , true ) ;
167- process . exit ( 1 ) ;
168- }
169- } ) ;
159+ if ( ! options . yes ) {
160+ await promptTerminal ( {
161+ type : 'confirm' ,
162+ name : 'value' ,
163+ message : 'OK to proceed with package installation?' ,
164+ initial : true ,
165+ } ) . then ( ( { value } ) => {
166+ if ( ! value ) {
167+ // @todo cleanup installed files
168+ logger ( 'Installation cancelled.' , true ) ;
169+ process . exit ( 1 ) ;
170+ }
171+ } ) ;
172+ }
170173
171174 spinner = ora ( 'Installing required packages' ) . start ( ) ;
172175 try {
You can’t perform that action at this time.
0 commit comments