1
1
mirror of https://github.com/kanaka/mal.git synced 2024-11-10 12:47:45 +03:00
mal/cs/readline.cs
2014-04-06 22:13:14 -05:00

25 lines
675 B
C#

using System;
using Mono.Terminal; // LineEditor (getline.cs)
namespace Mal {
public class readline {
public enum Mode { Terminal, Raw };
public static Mode mode = Mode.Terminal;
static LineEditor lineedit = null;
public static string Readline(string prompt) {
if (mode == Mode.Terminal) {
if (lineedit == null) {
lineedit = new LineEditor("Mal");
}
return lineedit.Edit(prompt, "");
} else {
Console.Write(prompt);
Console.Out.Flush();
return Console.ReadLine();
}
}
}
}