Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

386
Visualizações
How to select an answer from options in command line(terminal) using python.?

I am trying to access command line form python code. here is two example where I got stuck. In this code, there is a question and 3 or 4 options to select as answer. How can I select any of these answer using python code. In real case If I am using it from command line I have to use up and down arrow ↑ ↓ key or right and left arrow < > key then enter key to select any one of the options.

*example:1>*

? How would you like to use ESLint? … 
  To check syntax only
▸ To check syntax and find problems
  To check syntax, find problems, and enforce code style

*example:2>*

✔ How would you like to use ESLint? · problems
? What type of modules does your project use? … 
▸ JavaScript modules (import/export)
  CommonJS (require/exports)
  None of these

Normally, I have to answer it by selecting answer from list and pressing enter from terminal, is there any possibility to answer these questions by using python code?


Here I am describing my use case.

I am trying to create automate ESLint vulnerability check for TypeScript files using python.

I am able to run ESLint --init to initialise ESLint in my project. While initializing ESLint --init is asking some questions to specify the type of project. Some of the questions are following:

*example:1>*

? How would you like to use ESLint? … 
  To check syntax only
▸ To check syntax and find problems
  To check syntax, find problems, and enforce code style

*example:2>*

✔ How would you like to use ESLint? · problems
? What type of modules does your project use? … 
▸ JavaScript modules (import/export)
  CommonJS (require/exports)
  None of these

Normally, I have to answer it by selecting answer from list and pressing enter from terminal, is there any possibility to answer these questions by using python code?

following code was used to run eslint --init from python code:

def eslint_init():
    if pathlib.Path('.eslintrc.js').exists():
        print('already initialized')
    else:
        os.system('eslint --init')
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda