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
34
35
36
37
38
39
40
41
42
43
44
45
46
|
import std.stdio;
import std.getopt;
import prompt.ps1;
import prompt.preexec;
import style.color;
struct Opt {
bool ps1;
bool rps1;
bool preexec;
int col;
int row;
}
void main(string[] argv) {
Opt opts;
GetoptResult args = getopt(
argv,
std.getopt.config.bundling,
"ps1|p", "print PS1", &opts.ps1,
"rps1|r", "print RPS1", &opts.rps1,
"preexec|x", "print preexec", &opts.preexec,
std.getopt.config.required,
"col", "terminal width", &opts.col,
std.getopt.config.required,
"row", "terminal height", &opts.row,
);
if (args.helpWanted) {
defaultGetoptPrinter("prim", args.options);
}
if (opts.ps1) {
ps1(opts.col).setColor(Color.black).write();
}
if (opts.preexec) {
preexec(opts.col).setColor(Color.black).write();
}
write(setColor("", Color.reset));
}
|