[Mono-list] Fwd: getline.cs Partying like its 1988
Andy_Bach at wiwb.uscourts.gov
Andy_Bach at wiwb.uscourts.gov
Fri Aug 29 11:53:14 EDT 2008
via Miguel de Icaza on 8/26/08
http://tirania.org/blog/archive/2008/Aug-26.html
In an age where the Unix shell is more relevant every passing minute, we
need to have proper command line editing tools everywhere.
For a project of mine, this weekend I put together a command-line editing
class for .NET shell applications. The Mono.Terminal.LineEdit class can be
used by shell applications to get readline-like capabilities without
depending on any external C libraries.
To use it, just do:
using Mono.Terminal;
LineEditor le = new LineEditor ("MyApp");
while ((s = le.Edit ("prompt> ", "")) != null)
Console.WriteLine ("You typed: " + s);
It supports the regular cursor editing, Emacs-like editing commands,
history, incremental search in the history as well as history loading and
saving.
The code is self-contained, and can be easily reused outside of my
project. To use it, you just need to include the getline.cs file in your
project. This is built on top of System.Console, so it does not have
external library dependencies and will work on both Mono and .NET (finally
bringing joy to people using command-line applications that use
Console.ReadLine).
It is licensed under the MIT X11 license and the Apache 2.0 license so
there are no annoying licensing issues and can be mixed with anything out
there.
-------------------
Andy Bach
Systems Mangler
Internet: andy_bach at wiwb.uscourts.gov
Voice: (608) 261-5738 Fax: 264-5932
Don't get suckered in by the comments -- they can be terribly misleading.
Debug only code.
-- Dave Storer
More information about the Mono-list
mailing list