Questions tagged [readline]

A library for command line editing, or a function to read one line of text.

Readline may refer either the GNU readline library, used for editing a command line; or a function or method in various programming languages which typically reads a line of text from an open file handle.

GNU readline library

The gnu readline library provides applications with an interactive command prompt with features like

  • flexible command editing
  • configurable key bindings to mimic e.g. or
  • a history of past commands

Probably the most prominent application using readline is . Both packages are maintained by the same person. Many programming languages provide bindings for this library.

readline function

Examples of readline functions or methods include

(please extend this list if you know more languages using this name)

2233 questions
6
votes
0 answers

JavaScript - testing implementation of NodeJS readline.createInterface using Jasmine

I'm building a command-line application in NodeJS and I want to thoroughly test it using Jasmine. I've implemented a promptUser() method which uses Node's readline.createInterface method to pose a question and pipe the response into a callback. I…
6
votes
2 answers

Read text file (Unicode) in 'C' using native Win32

I have a line-oriented text file (Unicode) that was created using CreateFile() and WriteFile(). Reading that file as a binary stream using ReadFile() is straightforward, but extra low-level processing is needed to break it into lines. Is there a…
Android Eve
  • 14,864
  • 26
  • 71
  • 96
6
votes
2 answers

Generate a Pop-up box in R

Is it possible to make a pop-up box appear to the user to input a value in R? I've put together a pair of lines that perform the equivalent function using readline, but is it possible to make the prompt appear somewhere other than the console? …
J. Kovacs
  • 157
  • 1
  • 1
  • 10
6
votes
3 answers

PHP: Adding Arrow Key Support to STDIN/Single Character Processing

In PHP, I can read in input from a command line program with the following code $stream = STDIN; $test = fgets($stream); echo $test; This works well for simple input. However, if I try to use something like an back arrow key, my shell looks like…
Alana Storm
  • 164,128
  • 91
  • 395
  • 599
6
votes
1 answer

Changing tab-completion for read builtin in bash

The current tab-completion while "read -e" is active in bash seems to be only matching filenames: read -e [[TabTab]] abc.txt bcd.txt cde.txt I want the completion to be a set of strings defined by me, while file/dir/hostname-completion etc.…
Mustermann
  • 109
  • 1
  • 1
  • 9
6
votes
2 answers

Asynchronous cmd or readline in Python

I would like to write a simple program that both (1) produces lines of output simultaneously, and (2) accepts input from the user via a command line (via readline). (Think of a text-mode chat client, for example. I want to be able to compose my…
nibot
  • 14,428
  • 8
  • 54
  • 58
6
votes
3 answers

Node.js: How to increase readline/inquirer prompt height

I'm using inquirer.js for creating a yeoman-generator and when it comes to a long list as prompt the height of it is too short to show all items. How can I increase it?. I know inquirer.js uses an extended version of node.js's readline, I don't know…
R01010010
  • 5,670
  • 11
  • 47
  • 77
6
votes
1 answer

PyCharm: Up arrow doesn't work in the console on readline prompt

I am trying to use PyCharm console with pdb, IPython, ipdb and other software relying on readline library. The console software use this library to provide command history and autocompletion. When you press up arrow you get the previous…
Mikko Ohtamaa
  • 82,057
  • 50
  • 264
  • 435
6
votes
2 answers

Not enough storage is available for `Console.ReadLine`.`

I am using a dual service/console model to test a service of mine. The code in the spotlight is: static void Main(string[] args) { // Seems important to use the same service instance, regardless of debug or runtime. var service = new…
ProfK
  • 49,207
  • 121
  • 399
  • 775
6
votes
2 answers

readline-like library for Java

Which readline-like library for Java do you use? By 'readline' like library I mean library for editing console input, with support for history, tab-completion, and stuff like this. I'm looking for one, and I cannot choose from so many choices (jLine…
Peter Štibraný
  • 32,463
  • 16
  • 90
  • 116
6
votes
4 answers

Can't run rails c in terminal because of "Pry failed to get user input using `Readline`."

I can't seem to run rails c in terminal. It keeps giving me this error Loading development environment (Rails 4.2.0.beta2) [1] pry(main)> Error: Input/output error - /dev/null /Users/Bito/.gem/ruby/2.0.0/gems/pry-0.10.1/lib/pry/repl.rb:198:in…
6
votes
2 answers

Python readline, tab completion cycling with the Cmd interface

I am using the cmd.Cmd class in Python to offer a simple readline interface to my program. Self contained example: from cmd import Cmd class CommandParser(Cmd): def do_x(self, line): pass def do_xy(self, line): pass …
Edd Barrett
  • 3,425
  • 2
  • 29
  • 48
6
votes
3 answers

Autocomplete command line arguments from a list in a file

Assume I have a program called script.py and it allows for the command line option -i which requires an additional keyword argument, such that I call python script.py -i foo Now assume in my working directory I have a file named tags.txt which…
marc
  • 81
  • 1
  • 5
6
votes
2 answers

With Node.js, how to ask user confirmation to overwrite a file?

I have a command line program in Javascript/Node.js that writes data to files. I want to ask user confirmation to overwrite a file, if it already exists. This fails: function writeData (filename, data) { var fs = require ('fs'); try { …
oluc
  • 311
  • 1
  • 4
  • 8
6
votes
3 answers

Using the Python shell in Vi mode on Windows

I know that you can use the Python shell in Vi mode on Unix-like operating systems. For example, I have this line in my ~/.inputrc: set editing-mode vi This lets me use Vi-style editing inside the Python shell. But can this be made to work when…
Brian Neal
  • 31,821
  • 7
  • 55
  • 59