GNOME Bugzilla – Bug 563057
GNU Readline Bindings
Last modified: 2009-11-20 07:26:22 UTC
There should be an easy and safe way for Vala explorers to read string user input from console. I have attached the beginning of a readline.vapi file which contains only two functions so far but can get extended as needed. Example usage: --------- static void main () { while (true) { var name = ReadLine.read_line ("Please enter your name: "); if (name != null && name != "") { stdout.printf ("Hello, %s!\n", name); ReadLine.add_history (name); } } } --------- $ valac --pkg readline -X -lreadline readlinesample.vala $ ./readlinesample
Created attachment 123848 [details] [review] Beginning of GNU Readline Bindings
Do we need to split bindings for libreadline and libhistory?
(In reply to comment #2) > Do we need to split bindings for libreadline and libhistory? No, I think they belong together. On my distribution they are packaged together, and I have never seen anyone using libhistory without libreadline.
Created attachment 134291 [details] my take on readline.vapi I'm using this in fso-term, a serial terminal program written in Vala.
*** Bug 592944 has been marked as a duplicate of this bug. ***
commit 84234c9a2ab6c9f9a4eb35bd6ce0a6e0b614f18d Author: Jukka-Pekka Iivonen <jp0409@jippii.fi> Date: Thu Nov 19 23:21:11 2009 -0800 Add readline bindings. Fixes bug 563057.