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
22
votes
4 answers

How to use the PHP interactive shell

I'm using Ubuntu 12.04 (Precise Pangolin) 64 bit, and I want to use the PHP interactive shell: php -a But it doesn't seem to work very well, and a lot of syntax is incorrectly interpreted. When I run php -a, it displays: interactive mode…
mohur
  • 1,785
  • 4
  • 16
  • 25
21
votes
8 answers

Clear terminal window in Node.js readline shell

I have a simple readline shell written in Coffeescript: rl = require 'readline' cli = rl.createInterface process.stdin, process.stdout, null cli.setPrompt "hello> " cli.on 'line', (line) -> console.log line cli.prompt() cli.prompt() Running…
mkopala
  • 1,262
  • 3
  • 12
  • 15
21
votes
11 answers

How to take two consecutive input with the readline module of node.js?

I am creating a program to take input of two numbers from the command line and then showing there sum in node.js. I am using readline module to take stdin. Below is my code. const readline = require('readline'); const rl =…
Puneet Singh
  • 211
  • 1
  • 2
  • 4
21
votes
2 answers

R command history: how to configure up-arrow to treat "multiline, brace-enclosed input" as one line?

This question is about configuring the R console to behave like a bash shell when it comes to navigating the command history. It is somewhat related to the ?history. For brace-enclosed multi-lines, I'd like to configure the command history…
mike
  • 221
  • 1
  • 7
21
votes
1 answer

Is there a nice way of handling multi-line input with GNU readline?

My application has a command line interface, and I'm thinking about using the GNU Readline library to provide history, an editable command line, etc. The hitch is that my commands can be quite long and complex (think SQL) and I'd like to allow users…
John Carter
  • 53,924
  • 26
  • 111
  • 144
19
votes
3 answers

python's readline module not available for windows?

Granted I've been off PYTHON for two + years. I'm trying to get back into the swing, and I remember having command and variable completion available on windows a few years back. We were stuck in 2.6 as we had dependencies. Today, I'm trying to…
Anonymous Cowherd
  • 311
  • 1
  • 2
  • 8
18
votes
3 answers

install ruby 1.9.3 using rvm on ubuntu

Possible Duplicate: Ruby 1.9.2 and Rails 3 cannot open rails console I have already installed rvm and ruby 1.9.2, both working properly. Using rvm version 1.10.2. I previously installed the rvm packages readline/zlib, but now I'm having big…
CLod
  • 917
  • 2
  • 11
  • 28
18
votes
6 answers

readline doesn't stop line reading after rl.close() emit in nodejs

I have the following file I want to read line by line and stop reading it once I have found "nameserver 8.8.8.8". nameserver 8.8.8.8 nameserver 45.65.85.3 nameserver 40.98.3.3 I am using nodejs and the readline module to do so const readline =…
gvoigt
  • 181
  • 1
  • 1
  • 4
18
votes
1 answer

Bash bracketed paste - is it supported?

Despite some effort, I have been unable to get the "bracketed paste" feature of Bash working. My terminal is xterm, which supports it. My version of bash is 4.3.33(1)-release, which I think supports it, based on the date of this thread. I have tried…
jwd
  • 10,837
  • 3
  • 43
  • 67
18
votes
5 answers

C readline function

In an assignment for college it was suggested to use the C readline function in an exercise. I have searched for its reference but still haven't found it. Does it really exist? In which header? Can you please post the link to the reference?
nunos
  • 20,479
  • 50
  • 119
  • 154
18
votes
3 answers

createInterface prints double in terminal

when using the readline interface, everything from stdin gets printed twice to stdout: var rl = require('readline'); var i = rl.createInterface(process.stdin, process.stdout); when i run this code, everything i type in the terminal is duplicated.…
dopatraman
  • 13,416
  • 29
  • 90
  • 154
18
votes
2 answers

Convert \r text to \n so readlines() works as intended

In Python, you can read a file and load its lines into a list by using f = open('file.txt','r') lines = f.readlines() Each individual line is delimited by \n but if the contents of a line have \r then it is not treated as a new line. I need to…
greye
  • 8,921
  • 12
  • 41
  • 46
18
votes
8 answers

Reading lines with BufferedReader and checking for end of file

If I have something like this in my code: String line = r.readLine(); //Where r is a bufferedReader How can I avoid a crash if the next line is the end of the file? (i.e. null) I need to read the next line because there may be something there that…
Zippy
  • 3,826
  • 5
  • 43
  • 96
18
votes
3 answers

equivalent of Console.ReadLine() in c++

My teacher just gave me an assignment in c++ and I am trying to get a string with scanf but it only get the last characters typed. Can anyone help me please? I am looking for the equivalent of console.readline() in c++. edit : I must also be able…
ESD
  • 675
  • 2
  • 12
  • 35
17
votes
6 answers

Installing ipython with readline on the mac

I am using ipython on Mac OS 10.5 with python 2.5.1 (I would actually like to use ipython for 2.6.1, but it doesn't seem to be available?) I installed ipython via easy_install. It works but is missing gnu readline (needed for nice searching of…
pythoneer