From 26ba41d08f86fc006edf9c0552205e2851a1060b Mon Sep 17 00:00:00 2001 From: Shav Kinderlehrer Date: Thu, 10 Aug 2023 10:44:06 -0400 Subject: Fix rendering issues + add git comp --- source/prompt/rps1.d | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) (limited to 'source/prompt/rps1.d') 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; } -- cgit v1.2.3