Questions tagged [inquirer]
77 questions
0
votes
1 answer
cant get ES modules to work with import or require
I'm building a command line based application and was using require to link various files and node modules. I have previously used Require with no issues and now I get nothing but errors.
Error with Require:
Error [ERR_REQUIRE_ESM]: require() of ES…

dhuw
- 9
- 3
0
votes
0 answers
Answering InquirerPy prompts in a unit test (pytest) for Continous Integration (Gitlab CI)
I have written a program that utilizes "InquirerPy" to create and validate a series of prompts for our users.
Problem is I realized that these prompts need to be unit tested in our Continuous Integration setup.
Example:
from InquirerPy import…

legendenomgeorg
- 1
- 2
0
votes
1 answer
NPM CLI returns command not found
I have created a simple CLI to bootstrap projects with inquirer and have successfully published it to NPM. However, when installing it with
npm i -g noobject
it's successfully loading and installing.
When running
noobject
in the cmd line, it does…
user18197344
0
votes
0 answers
Javascript Inquirer (npm package) promt quits with exit code one only in one place in the program
I tried to make a simple cli nodejs game, with inquirer to ask for player input - name and question answers.
I wrote the following code, which works as expected:
async function askName() {
playerName = (await inquirer.prompt({
name:…
0
votes
1 answer
How to change Python inquirer checkbox's select / unselect symbol from X and o to Y and N respectively?
The sample script:
import os
import sys
from pprint import pprint
import yaml
sys.path.append(os.path.realpath("."))
import inquirer # noqa
questions = [
inquirer.Checkbox(
"interests",
message="What are you interested in?",
…

puravidaso
- 1,013
- 1
- 5
- 22
0
votes
1 answer
Storing function parameters within a variable
I'm trying to store parameters in a variable to later be used in a function, such as simple InquirerPy question.
A simple, functional question might look like this:
from InquirerPy.separator import Separator
from InquirerPy import…

Solebay Sharp
- 519
- 7
- 24
0
votes
1 answer
'Function to return a choices array' in NPM inquirer (JavaScript)
I am trying to figure out how to use a function to return choices in an inquirer prompt but I can't seem to find any examples or explanations on how to do this. I have a MySQL2 query:
db.query(`SELECT id AS value, name FROM departments`, (req, res)…

sarawrmas
- 1
- 1
0
votes
1 answer
How to Initialise class properties using inquirer js?
class Example {
constructor(id) {
this.id = this.getId();
}
getId() {
inquirer
.prompt({
message: "Enter id?",
type: "input",
name: "employeesId",
…

lewy192
- 21
- 6
0
votes
1 answer
Using inquirer in a dictionary
I am trying to make a dictionary that gets input from the user. My current code is(not finished in a long way)
person = {
"name": str(inp("Enter your name: ")),
"age": int(inp("Enter your age: ")),
"gender": # Help
}
Okay, so I also wrote a…

Espiring
- 69
- 8
0
votes
2 answers
How can I validate that a user input their email when using Inquirer npm?
I'm using nodeJS and inquirer to generate an html that contains the details the user enters. This is just a snippet of the code but is there something I could add to make sure that in the email question they actually give an answer in email…

mcilhaggis
- 55
- 1
- 10
0
votes
1 answer
How do I create a function parameter (variable) for the answers to an inquirer.prompt question in javascript? MySQL is also involved
How do I create a function parameter (variable) for the answers to an inquirer.prompt question in JavaScript? I know how to do this without using variables, but to make my function addToTable easier to use throughout my code, I wanted to use…

Mr. Dawit
- 103
- 2
- 10
0
votes
2 answers
How can I run a command once fs is done writing to a file?
Here is the code in question:
const scriptFiles = fs.readdirSync(scriptsPath)
.filter(file => file.endsWith(".sql"));
for (const file of scriptFiles) {
var data = fs.readFileSync(`${scriptsPath}/${file}`,…

Revircs
- 1,312
- 3
- 12
- 23
0
votes
1 answer
How to combine mocha with inquirer.js
I am looking to make my automation tests a bit more flexible. I have a QA team that does not know much javascript and possibly have to design the tests for users with no or little programming skills.
I had a few scripts created using mocha test…

perez6736
- 1
- 3
0
votes
2 answers
How to wait inquirer answer to be processed (by fs.writeFile) before continuing asynchronously
So I have this asynchronous function with inquirer and fs.writeFile inside
(async () => {
...
if (process.env.IG_USERNAME && process.env.IG_PASSWORD) {
console.log(`Used as ${chalk.green(process.env.IG_USERNAME)}`);
} else {
…

Syakhisk Al-azmi
- 80
- 1
- 4
- 9
0
votes
1 answer
Javascript skipping for loop
I am writing a CLI application using JS and inquirer. From the following code, I expect to get some console.log() from both of the for loops. However, there is no console.log even if checkChoices and answers both have values inside of…

Angelina Tsuboi
- 196
- 1
- 2
- 14