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
10
votes
1 answer

How to force cmake to link against homebrew keg-only libraries

I have third party cmake project that depends on gnu readline library. So I installed readline by brew install readline. The problem is, readline is a keg-only formula and cmake tries to link it against libedit which shadows libreadline but it lacks…
Pouya
  • 1,266
  • 3
  • 18
  • 44
10
votes
5 answers

Node.js readline: Unexpected token =>

I am learning node.js and need to use readline for a project. I have the following code directly from the readline module example. const readline = require('readline'); const rl = readline.createInterface({ input: process.stdin, output:…
user3700129
  • 139
  • 1
  • 1
  • 7
10
votes
1 answer

How to make ghci support ^p to go up?

I use Ctrl p a lot instead of up arrow to go up on Terminal. How to make ghci support Ctrl p to go up? I use ghci from ghc98 from port. Mac OS X 10.5.8.
Kit
  • 101
  • 2
10
votes
2 answers

How to customize Readline keybindings of GHCi?

I know GHCi supports Readline, and keybindings such as ^W and ^U work as expected. I do wonder whether ghci support customization of keybindings the way Bash deals with inputrc.
Adaptee
  • 103
  • 5
10
votes
1 answer

Python, "filtered" line editing, read stdin by char with no echo

I need a function that reads input into a buffer as raw_input() would, but instead of echoing input and blocking until returning a full line, it should supress echo and invoke a callback every time the buffer changes. I say "buffer changes" instead…
salezica
  • 74,081
  • 25
  • 105
  • 166
10
votes
4 answers

Shift + Return to insert linebreak in python

I'm trying to get the behaviour of typical IM clients that use Return to send a text and Shift + Return to insert a linebreak. Is there a way to achieve that with minimal effort in Python, using e.g. readline and raw_input?
Manuel Ebert
  • 8,429
  • 4
  • 40
  • 61
10
votes
2 answers

MongoDB shell: reading a line from the console

Is there a way to read a line from the Mongo shell? readline() is not defined and neither is system.stdin. I need to do this in interactive mode, as opposed to feeding input to a script executed by the MongoDB shell.
Sim
  • 13,147
  • 9
  • 66
  • 95
9
votes
1 answer

How can I get (and set) current bash cursor position when using python readline?

I have a python script that takes manages the stdin, stdout, and stderr of any application and allows for readline to be inserted gracefully. Think of any application that has lots of console output, but also accepts commands from stdin. In any…
Jim Cortez
  • 471
  • 5
  • 19
9
votes
5 answers

Quickest way to read text-file line by line in Java

For log processing my application needs to read text files line by line. First I used the function readLine() of BufferedReader but I read on the internet that BufferedReader is slow when reading files. Afterwards I tried to use FileInputStream…
Yoni
  • 325
  • 2
  • 7
  • 15
9
votes
5 answers

Node.js readline inside of promises

I'm trying to use the node.js package readline to get user input on the command line, and I want to pipe the entered input through promises. However, the input never gets through the then chain. I think the problem could come from the fact that the…
Lukas Bach
  • 3,559
  • 2
  • 27
  • 31
9
votes
2 answers

How can I use readline synchronously?

I'm simply trying to wait for a user to enter a password and then use it before moving on the rest of my code. The error is Cannot read property 'then' of undefined. let rl = readline.createInterface({ input: process.stdin, output:…
Dustin Raimondi
  • 383
  • 1
  • 4
  • 10
9
votes
4 answers

How to limit the number of characters read by StreamReader.ReadLine() in .NET?

I am writing a web server application in C# and using StreamReader class to read from an underlying NetworkStream: NetworkStream ns = new NetworkStream(clientSocket); StreamReader sr = new StreamReader(ns); String request = sr.ReadLine(); This…
Roman Shumikhin
  • 613
  • 2
  • 6
  • 10
9
votes
1 answer

Pyreadline arbitrary autocomplete on windows

I am trying to implement an arbitrary autocomplete on windows for a command-line user interface I am writing. Inspired by the first answer to that question, I tried to just run the script written there, before realizing that I was on Windows and…
chiffa
  • 2,026
  • 3
  • 26
  • 41
9
votes
1 answer

Programmatically interrupting raw_input

Is there a way to programmatically interrupt Python's raw_input? Specifically, I would like to present a prompt to the user, but also listen on a socket descriptor (using select, for instance) and interrupt the prompt, output something, and…
Ray
  • 1,769
  • 1
  • 17
  • 22
9
votes
1 answer

How to configure the Racket interpreter to support command history?

I've just set up Racket and have been trying out the interpreter. However, I can't seem to go up and down the command history using the arrows (or Ctrlp/Ctrln for that matter) or use Ctrlr to search through it. Is that even supported? Can I build…
Nobilis
  • 7,310
  • 1
  • 33
  • 67