lib/config.js
function enterConfig() {
    const config = {};
    const rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout,
    });

    rl.question(`Do you want to use .gs as extension for your local code files instead of .js? [${'y'.green}/${'n'.red}]\n > `, (input) => {
        if (input === 'y') {
            config.extension = '.gs';
        } else if (input !== 'n') {
            endDialog(false);
            rl.close();
        }

        rl.question(`Do you want to use a custom OAuth 2.0 client to authenticate with Google? [${'y'.green}/${'n'.red}]\n > `, (input) => {
            if (input === 'y') {
                config.client = {};
                console.log();
                rl.question(`Enter the 'Client ID' of your client \n > `, (input) => {
                    config.client.id = input;
                    rl.question(`Enter the 'Client secret' of your client\n > `, (input) => {
                        config.client.secret = input;

                        // Remove token file to force reauth
                        fs.removeSync(tokenFile);

                        endDialog(true, config);
                        rl.close();
                    });
                });
            } else if (input === 'n') {
                endDialog(true, config);
                rl.close();
            } else {
                endDialog(false);
                rl.close();
            }
        });
    });
}
function enterConfig() {
    const config = {};
    const rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout,
    });

    rl.question(`Do you want to use .gs as extension for your local code files instead of .js? [${'y'.green}/${'n'.red}]\n > `, (input) => {
        if (input === 'y') {
            config.extension = '.gs';
        } else if (input !== 'n') {
            endDialog(false);
            rl.close();
        }

        rl.question(`Do you want to use a custom OAuth 2.0 client to authenticate with Google? [${'y'.green}/${'n'.red}]\n > `, (input) => {
            if (input === 'y') {
                config.client = {};
                console.log();
                rl.question(`Enter the 'Client ID' of your client \n > `, (input) => {
                    config.client.id = input;
                    rl.question(`Enter the 'Client secret' of your client\n > `, (input) => {
                        config.client.secret = input;

                        // Remove token file to force reauth
                        fs.removeSync(tokenFile);

                        endDialog(true, config);
                        rl.close();
                    });
                });
            } else if (input === 'n') {
                endDialog(true, config);
                rl.close();
            } else {
                endDialog(false);
                rl.close();
            }
        });
    });
}
function enterConfig ( ) { const config = { } ; const rl = readline . createInterface ( { input : process . stdin , output : process . stdout , } ) ; rl . question ( ` ${ 'y' . green } ${ 'n' . red } \n ` , ( input ) => { if ( input === 'y' ) { config . extension = '.gs' ; } else if ( input !== 'n' ) { endDialog ( false ) ; rl . close ( ) ; } rl . question ( ` ${ 'y' . green } ${ 'n' . red } \n ` , ( input ) => { if ( input === 'y' ) { config . client = { } ; console . log ( ) ; rl . question ( ` \n ` , ( input ) => { config . client . id = input ; rl . question ( ` \n ` , ( input ) => { config . client . secret = input ; // Remove token file to force reauth fs . removeSync ( tokenFile ) ; endDialog ( true , config ) ; rl . close ( ) ; } ) ; } ) ; } else if ( input === 'n' ) { endDialog ( true , config ) ; rl . close ( ) ; } else { endDialog ( false ) ; rl . close ( ) ; } } ) ; } ) ; }
Enter a configuration using questions in the terminal

@returns {void}
Enter a configuration using questions in the terminal