gash: Use a simple prompt on Mes.

* gash/gash.scm [mes] (prompt): Use plain ol' "$".
This commit is contained in:
Timothy Sample 2023-02-08 13:10:57 -06:00
parent b741e2a3e7
commit a1794de9f6
1 changed files with 19 additions and 15 deletions

View File

@ -142,21 +142,25 @@ There is NO WARRANTY, to the extent permitted by law.
(else (exit (run-repl (current-input-port) parse?))))))))
(thunk)))
(define prompt
(let* ((l (string #\001))
(r (string #\002))
(e (string #\033))
(user (getenv "USER"))
(host (gethostname))
(home (getenv "HOME")))
(lambda ()
(let* ((cwd (getcwd))
(cwd (if (string-prefix? home cwd)
(string-replace cwd "~" 0 (string-length home))
cwd)))
(string-append
l e "[01;32m" r user "@" host l e "[00m" r ":"
l e "[01;34m" r cwd l e "[00m" r (if (zero? (getuid)) "# " "$ "))))))
(cond-expand
(mes (define (prompt) "$ "))
(else
(define prompt
(let* ((l (string #\001))
(r (string #\002))
(e (string #\033))
(user (getenv "USER"))
(host (gethostname))
(home (getenv "HOME")))
(lambda ()
(let* ((cwd (getcwd))
(cwd (if (string-prefix? home cwd)
(string-replace cwd "~" 0 (string-length home))
cwd)))
(string-append
l e "[01;32m" r user "@" host l e "[00m" r ":"
l e "[01;34m" r cwd l e "[00m" r
(if (zero? (getuid)) "# " "$ "))))))))
(define (string-prefix s1 s2)
(substring/read-only s1 0 (string-prefix-length s1 s2)))