all repos — site @ 16b8a425094ef631e2d6b38701c537331ae36009

source for my site, found at icyphox.sh

Reword
Anirudh Oppiliappan x@icyphox.sh
Fri, 13 Aug 2021 09:34:35 +0530
commit

16b8a425094ef631e2d6b38701c537331ae36009

parent

b112be9a0fb27b5d28269a91a1d5abaa2cccc36e

1 files changed, 5 insertions(+), 5 deletions(-)

jump to
M pages/blog/go-shell-prompt.mdpages/blog/go-shell-prompt.md

@@ -22,10 +22,9 @@ month or so.

## the basics -In my prompt, the absolute basic piece of information I like to see is -the current working directory. I also prefer having them shortened; for -example: `/home/icy/docs/books/foo.epub` → `~/d/b/foo.epub`. Let's write -a function `trimPath` to do this for us: +The current working directory is the bare minimum in a prompt. I prefer +having it shortened; for example: `/home/icy/docs/books/foo.epub` → +`~/d/b/foo.epub`. Let's write a function `trimPath` to do this for us: ```go // Truncates the current working directory:

@@ -64,7 +63,8 @@ completely, just to be sure.

We then split the path at `/`[^2], and truncate each item in the resulting list -- except for the last -- down to the first character. -Join it all together and return the resulting string. +Join it all together and return the resulting string -- we have +`~/d/b/foo.epub`. [^2]: I don't care about Windows.