Giter Site home page Giter Site logo

Comments (8)

SBoudrias avatar SBoudrias commented on September 23, 2024

Hi, this is unlikely an issue coming from inquirer. Do you have code example?

from inquirer.js.

Bes-js avatar Bes-js commented on September 23, 2024

mainMenu function

async function mainMenu(){

    child_process.execSync('cls');

    await db.prepare('CREATE TABLE IF NOT EXISTS lang (value TEXT)').run();
   
    var langData = await db.prepare('SELECT * FROM lang').get();
    if(langData)lang.setLang(langData.value);
    if(!langData){
    var newLang = await setNewLanguage();
    await db.prepare('INSERT INTO lang (value) VALUES (?) ').run(newLang);
    lang.setLang(newLang);
    };

    var mainMenu = await select({
    message: lang.getText('main_menu'),
    theme:{ icon: { cursor: '=>' }},
    loop: false,
    choices: getChoices(arr)
    });

    import(`./events/${mainMenu}.mjs`);
   // arr.push(mainMenu);
    
};

selected list function

import { returnMainMenu, lang, setNewLanguage } from '../cli.js';
import db from '../services/database.js';
import child_process from 'child_process';


const select_new_lang = async () => {
var newLang = await setNewLanguage();
await db.prepare('UPDATE lang SET value = ? ').run(newLang);
lang.setLang(newLang);
child_process.execSync('cls');
return returnMainMenu();
};
select_new_lang();

return mainMenu function

async function returnMainMenu(){
child_process.execSync('cls');
var value = await select({
    message: lang.getText('return_to_main_menu'),
    choices: [
        {name:lang.getText('yes'),value:'return'},
        {name:lang.getText('no'),value:'exit'}
    ]
});
if(value == 'exit')child_process.execSync('exit');
if(value == 'return')mainMenu();
};

from inquirer.js.

Bes-js avatar Bes-js commented on September 23, 2024
20240216-2103-14.4707216.mp4

from inquirer.js.

Bes-js avatar Bes-js commented on September 23, 2024

@SBoudrias

from inquirer.js.

SBoudrias avatar SBoudrias commented on September 23, 2024

Hi @Bes-js, there's a lot going on there.

What might help you is to simplify the case. Only make a recursive prompt with inquirer - see it works. Then add pieces by pieces and you'll likely find out where it breaks.

from inquirer.js.

Bes-js avatar Bes-js commented on September 23, 2024

When I opened a new project and tried just select from scratch, the same problem occurred again.

from inquirer.js.

Bes-js avatar Bes-js commented on September 23, 2024

It looks like a problem with the package, but when I tried such things in other languages it didn't cause any problems.

from inquirer.js.

SBoudrias avatar SBoudrias commented on September 23, 2024

Can you share your new project reproduction so I can run it?

from inquirer.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.