@@ -55,7 +55,7 @@ const SCRIPT_PREVIEW_CONFIG = {
5555
5656let tmpdir ;
5757
58- const performInstallation = async ( args , isUpdate = false ) => {
58+ const performInstallation = async ( args , isUpdate = false , yesFlag = false ) => {
5959 const log = createLogger ( ) ;
6060
6161 if ( args . length === 0 ) {
@@ -131,6 +131,8 @@ const performInstallation = async (args, isUpdate = false) => {
131131 `Ok to ${ isUpdate ? "update" : "install" } ${ selected . name } (${ fileSize (
132132 selected . size ,
133133 ) } )?`,
134+ "y" ,
135+ yesFlag
134136 ) ;
135137
136138 if ( ! shouldInstall ) {
@@ -385,6 +387,8 @@ const handleSingleScript = async (script, log) => {
385387
386388 const shouldRun = await confirm (
387389 "Run this edited install script (y) or continue to regular installation (n)?" ,
390+ "y" ,
391+ yesFlag
388392 ) ;
389393
390394 if ( shouldRun ) return editedScript ;
@@ -421,13 +425,16 @@ const handleMultipleScripts = async (installScripts, log) => {
421425 const scriptChoice = await promptChoice (
422426 `Which script would you like to edit? (1-${ installScripts . length } ): ` ,
423427 installScripts . length ,
428+ yesFlag
424429 ) ;
425430 const scriptToEdit = installScripts [ scriptChoice - 1 ] ;
426431 const editedScript = await editScriptInEditor ( scriptToEdit ) ;
427432 displayScriptPreview ( editedScript , log ) ;
428433
429434 const shouldRun = await confirm (
430435 "Run this edited install script (y) or choose a different one (n)?" ,
436+ "y" ,
437+ yesFlag
431438 ) ;
432439
433440 if ( shouldRun ) return editedScript ;
@@ -440,6 +447,8 @@ const handleMultipleScripts = async (installScripts, log) => {
440447
441448 const shouldRun = await confirm (
442449 "Run this install script (y) or choose a different one (n)?" ,
450+ "y" ,
451+ yesFlag
443452 ) ;
444453
445454 if ( shouldRun ) return script ;
@@ -518,7 +527,7 @@ const handleGitHubSource = async (source, platformInfo, capabilities, log) => {
518527 if ( installerScript ) {
519528 log . debug ( `Found installer script: ${ installerScript . name } ` ) ;
520529
521- if ( await confirm ( `Run install script? ${ installerScript . name } ` ) ) {
530+ if ( await confirm ( `Run install script? ${ installerScript . name } ` , "y" , yesFlag ) ) {
522531 const scriptPath = path . join ( tmpdir , "installer.sh" ) ;
523532 const { size } = await downloadFromUrl (
524533 installerScript . browser_download_url ,
@@ -652,7 +661,7 @@ const installSelected = async (selected, downloadPath, log) => {
652661
653662 if ( appFile ) {
654663 log . log ( `Installing .app bundle: ${ appFile } ` ) ;
655- destinations = await installApp ( appFile , mountDir , checkPath , log ) ;
664+ destinations = await installApp ( appFile , mountDir , checkPath , log , null , yesFlag ) ;
656665 binariesList = [ appFile ] ;
657666
658667 // Ask to open app
@@ -668,14 +677,15 @@ const installSelected = async (selected, downloadPath, log) => {
668677 log . log (
669678 "No .app or .pkg found in DMG, trying to install executables" ,
670679 ) ;
671- const selectedBinaries = await selectBinaries ( dmgBinaries , selected . name , log ) ;
680+ const selectedBinaries = await selectBinaries ( dmgBinaries , selected . name , log , yesFlag ) ;
672681 destinations = await installBinaries (
673682 selectedBinaries ,
674683 mountDir ,
675684 selected . name ,
676685 checkPath ,
677686 log ,
678687 true , // isMountedVolume = true
688+ yesFlag
679689 ) ;
680690 binariesList = selectedBinaries . map ( ( bin ) => path . basename ( bin ) ) ;
681691 } else {
@@ -700,10 +710,12 @@ const installSelected = async (selected, downloadPath, log) => {
700710 path . dirname ( downloadPath ) ,
701711 checkPath ,
702712 log ,
713+ null ,
714+ yesFlag
703715 ) ;
704716 binariesList = [ selected . name ] ;
705- // Ask to open app
706- if ( await confirm ( `Open app ${ path . basename ( destinations [ 0 ] ) } ?` ) ) {
717+ // Ask to open app
718+ if ( await confirm ( `Open app ${ path . basename ( destinations [ 0 ] ) } ?` , "y" , yesFlag ) ) {
707719 execSync ( `open -n ${ JSON . stringify ( destinations [ 0 ] ) } ` ) ;
708720 }
709721 break ;
@@ -737,28 +749,32 @@ const installSelected = async (selected, downloadPath, log) => {
737749 selected . name ,
738750 checkPath ,
739751 log ,
752+ false ,
753+ yesFlag
740754 ) ;
741755
742756 if ( packageResult ) {
743757 // Use the package installation result
744758 installationMethod = packageResult . method ;
745759 destinations = packageResult . destinations ;
746760 binariesList = packageResult . binaries ;
747- if ( installationMethod === "archive_app" ) {
761+ if ( installationMethod === "archive_app" ) {
748762 // Ask to open app
749- if ( await confirm ( `Open app ${ path . basename ( destinations [ 0 ] ) } ?` ) ) {
763+ if ( await confirm ( `Open app ${ path . basename ( destinations [ 0 ] ) } ?` , "y" , yesFlag ) ) {
750764 execSync ( `open -n ${ JSON . stringify ( destinations [ 0 ] ) } ` ) ;
751765 }
752766 }
753767 } else {
754768 // Fall back to regular binary installation
755- const selectedBinaries = await selectBinaries ( extractedBinaries , selected . name , log ) ;
769+ const selectedBinaries = await selectBinaries ( extractedBinaries , selected . name , log , yesFlag ) ;
756770 destinations = await installBinaries (
757771 selectedBinaries ,
758772 outputDir ,
759773 selected . name ,
760774 checkPath ,
761775 log ,
776+ false ,
777+ yesFlag
762778 ) ;
763779 binariesList = selectedBinaries . map ( ( bin ) => path . basename ( bin ) ) ;
764780 }
0 commit comments