1
1
mirror of https://github.com/kanaka/mal.git synced 2024-11-11 00:52:44 +03:00
mal/vb/readline.vb
2015-01-09 16:16:47 -06:00

33 lines
859 B
VB.net

Imports System
Imports Mono.Terminal ' LineEditor (getline.cs)
Namespace Mal
Public Class readline
Enum Modes
Terminal
Raw
End Enum
Public Shared mode As Modes = Modes.Terminal
Shared lineedit As LineEditor = Nothing
Public Shared Sub SetMode(new_mode As Modes)
mode = new_mode
End Sub
Public Shared Function Readline(prompt As String) As String
If mode = Modes.Terminal Then
If lineedit Is Nothing Then
lineedit = New LineEditor("Mal")
End If
return lineedit.Edit(prompt, "")
Else
Console.Write(prompt)
Console.Out.Flush()
return Console.ReadLine()
End If
End Function
End Class
End Namespace