forked from litedb-org/LiteDB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
33 lines (30 loc) · 1.19 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
namespace LiteDB.Shell
{
internal class Program
{
/// <summary>
/// Opens console shell app. Usage:
/// LiteDB.Shell [myfile.db] --param1 value1 --params2 "value 2"
/// Parameters:
/// --exec "command" : Execute an shell command (can be multiples --exec)
/// --run script.txt : Run script commands file
/// --pretty : Show JSON in multiline + indented
/// --exit : Exit after last command
/// </summary>
private static void Main(string[] args)
{
var input = new InputCommand();
var display = new Display();
var o = new OptionSet();
// default arg
o.Register((v) => input.Queue.Enqueue("open " + v));
o.Register("pretty", () => display.Pretty = true);
o.Register("exit", () => input.AutoExit = true);
o.Register<string>("run", (v) => input.Queue.Enqueue("run " + v));
o.Register<string>("exec", (v) => input.Queue.Enqueue(v));
// parse command line calling register parameters
o.Parse(args);
ShellProgram.Start(input, display);
}
}
}