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

"ImportError: No module named readline" running "repo init"

I downloaded the source of Android, but when I used repo init according to the website, I got the following error: Traceback (most recent call last): File "/root/bin/repo", line 91, in import readline ImportError: No module named…
enterzhu
  • 87
  • 1
  • 1
  • 7
4
votes
1 answer

vi readline support for jruby's irb

I recently started using jruby. In normal ruby's irb, I get vi readline support due to the .editrc file .editrc file bind -v But jruby doesn't seem to use that file, and doesn't get the vi readline from the .inuptrc file either. Is there a way to…
Tim
  • 365
  • 2
  • 15
4
votes
5 answers

Bash: Split a string exactly like Readline would split it

Given a string representation of an arbitrary Bash "simple command", how can I split it into an array containing its individual "parts", i.e. the command name and individual parameters, just like the the shell itself (i.e. Readline) would split it…
smls
  • 5,738
  • 24
  • 29
4
votes
2 answers

libedit/readline conflict with ipython 3.2.2 on OS X 10.7 Lion

I've been trying to set up ipython 3 (running 2.7 works fine) on a mac running Lion, but can't seem to get rid of the following error: 192:~ mlauria$…
gnr
  • 2,324
  • 1
  • 22
  • 24
4
votes
1 answer

How can I get case-insensitive completion with Term::ReadLine::Gnu?

I can't seem to get case-insensitive completion when using Term::ReadLine::Gnu. Take this example script: use strict; use warnings; use 5.010; use Term::ReadLine; my $term = Term::ReadLine->new('test'); say "Using " . $term->ReadLine; if (my…
cjm
  • 61,471
  • 9
  • 126
  • 175
4
votes
1 answer

How to save readline history in a text file and call it afterwards

Is it possible to save readline history in a text file and get the history after I reopen my program... char *line, *expansion; int result; stifle_history(7); while ((line = readline(" $ ")) != NULL) { result = history_expand(line,…
kanoz
  • 43
  • 1
  • 4
4
votes
3 answers

How to detect EOF when reading a file with readline() in Python?

I need to read the file line by line with readline() and cannot easily change that. Roughly it is: with open(file_name, 'r') as i_file: while True: line = i_file.readline() # I need to check that EOF has not been reached, so that…
Serge Rogatch
  • 13,865
  • 7
  • 86
  • 158
4
votes
2 answers

Why does using Python's '-i' or '-c' options cause readline history from previous sessions to be unavailable?

I'm using a .pythonsetup file to enable readline history in the manner described in the readline module docs. Normally, history from previous interactive interpreter sessions is available when I start up a new session. % python >>> # history…
David
  • 1,010
  • 10
  • 18
4
votes
0 answers

readLine() only reads second input in console

I'm just getting started with Kotlin, so I apologize if it's a dumb problem (which I think it probably is). I'm following this guide, but ran in an issue: the readLine function ignores my first input, and returns only the second line I insert. fun…
4
votes
6 answers

AttributeError: 'str' object has no attribute 'readline'

Update: My current question is how can I get my code to read to the EOF starting from the beginning with each new search phrase. This is an assignment I am doing and currently stuck on. Mind you this is a beginner's programming class using…
SD.
  • 3,089
  • 10
  • 26
  • 21
4
votes
2 answers

how to read a line from stdin again after reading something from stdin in C?

This program runs fine. int main() { { printf("Type something:\n"); char* message = malloc(64 * sizeof(char)); fgets(message, 64, stdin); printf("message ist : %s\n", message); free(message); } } But…
Cathen
  • 45
  • 3
4
votes
0 answers

Readline completion tab extra space

I'm trying to set auto-complete for readline to enable a user to navigate through the filesystem directories when running a script through CLI. I found out PHP has a function called readline_completion_function for this purpose but every time I hit…
CIRCLE
  • 4,501
  • 5
  • 37
  • 56
4
votes
3 answers

Read Usernames and Passwords from a txt file

I need to pull usernames and passwords from a .txt file and I am having a difficult time wrapping my mind around how exactly to do this. I'll try to break this down. Open the file Read in the Usernames Compare a username against a user…
Jimmathy
  • 327
  • 8
  • 23
4
votes
3 answers

Type a text on shell prompt

Is there any way in the shell script by which I can set the input line programmatically? Consider the following scenario. Let's say I make a script to create a git branch, and right after it is done making a branch, I don't want to switch to new…
arxoft
  • 1,385
  • 3
  • 17
  • 34
4
votes
1 answer

NodeJS get color in readline

I have a NodeJS app that needs to execute some commands using spawn, I'm reading the output for later processing using readline which works flawlessly. But I also need to get the color of the text, For example: when executing another Node.js script…
Benjie Wheeler
  • 555
  • 3
  • 16