diff options
author | Shav Kinderlehrer <[email protected]> | 2023-08-10 10:44:06 -0400 |
---|---|---|
committer | Shav Kinderlehrer <[email protected]> | 2023-08-10 10:44:06 -0400 |
commit | 26ba41d08f86fc006edf9c0552205e2851a1060b (patch) | |
tree | 06446a566208b343edfd6ad8eec0258afa39ab73 /source/prompt/rps1.d | |
parent | db53ee6c3bdd8d14c196f06b6377f2418779f82d (diff) | |
download | prim-26ba41d08f86fc006edf9c0552205e2851a1060b.tar.gz prim-26ba41d08f86fc006edf9c0552205e2851a1060b.zip |
Fix rendering issues + add git comp
Diffstat (limited to 'source/prompt/rps1.d')
-rw-r--r-- | source/prompt/rps1.d | 31 |
1 files changed, 6 insertions, 25 deletions
diff --git a/source/prompt/rps1.d b/source/prompt/rps1.d index 9ec5ac7..075707e 100644 --- a/source/prompt/rps1.d +++ b/source/prompt/rps1.d @@ -1,15 +1,10 @@ module prompt.rps1; -import std.conv; -import std.regex; -import std.array; - -import std.file : getcwd; -import std.path : expandTilde; -import std.algorithm : reverse; - import prim.opt; +import comp.path; +import comp.git; + import style; import style.color; import style.font; @@ -17,22 +12,8 @@ import style.font; string rps1(Opts opt) { string ps; - string home = expandTilde("~"); - string path = replaceFirst(getcwd(), regex(home), "~"); - - string[] splitPath = path.split("/").reverse(); - - string[] revSplitPath; - for (int i = 0; i < opt.pathlen; i++) { - if (i >= splitPath.length) - break; - - revSplitPath ~= splitPath[i]; - } - - splitPath = revSplitPath.reverse(); - - ps ~= splitPath.join("/"); + ps ~= (gitBranch()).set(Font.bold).set(Color.cyan); + ps ~= (gitStatus()); - return ps.set(Font.italic).set(Color.yellow); + return ps; } |