diff options
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; } |