BadScript 2
Loading...
Searching...
No Matches
BadScript2.Interactive.BadInteractiveExtensions Class Reference

Interactive Console Extensions for the BadScript Runtime. More...

Static Public Member Functions

static void RunInteractive (this BadRuntime runtime, IEnumerable< string > files)
 Runs the Interactive Console.
 
static async Task RunInteractiveAsync (this BadRuntime runtime, IEnumerable< string > files)
 

Detailed Description

Interactive Console Extensions for the BadScript Runtime.

Definition at line 9 of file BadInteractiveExtensions.cs.

Member Function Documentation

◆ RunInteractive()

static void BadScript2.Interactive.BadInteractiveExtensions.RunInteractive ( this BadRuntime  runtime,
IEnumerable< string >  files 
)
static

Runs the Interactive Console.

Parameters
runtimeThe Runtime to use
filesThe Files to load before the Interactive Session begins

Definition at line 16 of file BadInteractiveExtensions.cs.

17 {
18 BadInteractiveConsole console = new BadInteractiveConsole(runtime, BadTaskRunner.Instance, files);
19
20 while (true)
21 {
22 BadConsole.Write(">");
23 string cmd = BadConsole.ReadLine();
24
25 if (cmd == "exit")
26 {
27 return;
28 }
29
30 console.Run(cmd);
31 }
32 }
Wrapper class for the console abstraction.
Definition BadConsole.cs:12
static string ReadLine()
Reads a line from the console.
Definition BadConsole.cs:85
static void Write(string str)
Writes a string to the console.
Definition BadConsole.cs:67
static readonly BadTaskRunner Instance
The Task Runner Instance.

◆ RunInteractiveAsync()

static async Task BadScript2.Interactive.BadInteractiveExtensions.RunInteractiveAsync ( this BadRuntime  runtime,
IEnumerable< string >  files 
)
static

Definition at line 34 of file BadInteractiveExtensions.cs.

35 {
36 BadInteractiveConsole console = new BadInteractiveConsole(runtime, BadTaskRunner.Instance, files);
37
38 while (true)
39 {
40 BadConsole.Write(">");
41 string cmd = await BadConsole.ReadLineAsync();
42
43 if (cmd == "exit")
44 {
45 return;
46 }
47
48 console.Run(cmd);
49 }
50 }
static Task< string > ReadLineAsync()
Reads a line from the console asynchronously.
Definition BadConsole.cs:94

The documentation for this class was generated from the following file: