small pixel drawing of a pufferfish dotfiles

prompt changes
j3s j3s@c3f.net
Sat, 17 Oct 2020 00:41:29 -0500
commit

8cfda0b6c77db37afa32824a48947333bb75c50e

parent

aabec1b1fe2a2428be86cccf975969f6b9ca3420

5 files changed, 41 insertions(+), 9 deletions(-)

jump to
M .profile.profile

@@ -1,2 +1,2 @@

-export PATH="$HOME/bin/$(hostname):$HOME/bin:$PATH" +export PATH=~/bin/$(hostname):~/bin/$(uname -m):~/bin:$PATH export ENV=~/.shinit
M .shinit.shinit

@@ -30,4 +30,4 @@ chruby ruby-2.6.2

fi export EDITOR=vim -export PS1='$(short-pwd)$ ' +export PS1='$(prompt)$ '
A bin/prompt.go

@@ -0,0 +1,38 @@

+package main + +import ( + "fmt" + "os" + "strings" + "syscall" + "time" +) + +func main() { + cwd, _ := os.Getwd() + host, _ := os.Hostname() + home := os.Getenv("HOME") + var parts []string + if strings.HasPrefix(cwd, home) { + cwd = "~" + cwd[len(home):] + } + var sysinfo syscall.Sysinfo_t + syscall.Sysinfo(&sysinfo) + uptime := time.Duration(sysinfo.Uptime) * time.Second + fmt.Printf("\033[38;5;162m[%d:%02d:%02d] %s\033[0m ", int64(uptime.Hours()), + int64(uptime.Minutes()) % 60, int64(uptime.Seconds()) % 60, + host) + + parts = strings.Split(cwd, "/") + for i, part := range parts { + if i == len(parts)-1 { + fmt.Printf("%s", part) + } else { + if len(part) != 0 { + fmt.Printf("%c/", part[0]) + } else { + fmt.Printf("/") + } + } + } +}
D bin/short-pwd

@@ -1,6 +0,0 @@

-#!/bin/sh -# -# /s/h/o/rtness - -term=$(printf "$PWD" | sed -E 's|(\.?[^/])([^/]+)\/|\1/|g') -printf "\033[38;5;162m$term\033[0m"
M bin/vibin/vi

@@ -1,3 +1,3 @@

#!/bin/sh -vim +vim "$@"