summaryrefslogtreecommitdiff
path: root/source/app.d
diff options
context:
space:
mode:
Diffstat (limited to 'source/app.d')
-rw-r--r--source/app.d24
1 files changed, 14 insertions, 10 deletions
diff --git a/source/app.d b/source/app.d
index 25bb8e9..ca934fa 100644
--- a/source/app.d
+++ b/source/app.d
@@ -2,20 +2,18 @@ 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 validate(Opt opts) {
- if (!opts.col || !opts.row)
- throw new Exception("--col and --row required");
-}
-
void main(string[] argv) {
Opt opts;
@@ -24,7 +22,11 @@ void main(string[] 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,
);
@@ -32,11 +34,13 @@ void main(string[] argv) {
defaultGetoptPrinter("prim", args.options);
}
- try {
- validate(opts);
- } catch (Exception e) {
- defaultGetoptPrinter(e.msg ~ "\n", args.options);
+ if (opts.ps1) {
+ ps1(opts.col).setColor(Color.black).write();
+ }
+
+ if (opts.preexec) {
+ preexec(opts.col).setColor(Color.black).write();
}
- ps1(opts.col).write();
+ write(setColor("", Color.reset));
}