4 ms·
Starship: Cross-shell prompt written in Rust
- junkblocker 5y agoSince I was trying out nushell, I came across Starthip which supports nushell! I noticed that prompt managers which run non-shell binaries may be unable to support things like showing the tty since I assume they are execing any external tools (/usr/bin/tty) in a non-tty environment. But still very cool to have the same prompt run unmodified in zsh, bash, nushell etc. The git VCS performance in it is pretty good too even in large monorepos.
- paulfurtado 5y agoOn linux (and I think even osx), even when stdin, stdout, and stderr are redirected, you can always get at the current session's tty via "/dev/tty" unless the executing program spawns a new session which would be very unlikely in this case. This is why things like sudo can defeat pipes and prompt you.
- junkblocker 5y agoOh, you are right! This works by looking at /proc/$ppid/fd/1 format = """$all\ ${custom.tty}""" [custom.tty] description = "tty" when = 'true' command = """ tpid=$(ps -o pid= -p "$(($(ps -o sid= -p "$$")))") tpid=$(( tpid + 0 )) readlink /proc/$tpid/fd/1 | sed -e 's|/dev/||' """ format = ' [$output]($style)' shell = ["bash", "--noprofile", "--norc"] style = 'blue'
- Twirrim 5y agoI love starship. Compiled binary, so it's extremely fast. I've tried a number of alternative prompt approaches in the past, but they've almost all been script based approaches, and the delay as the prompt message was generated was always palpable to me. Starship has been the only one I've stuck with, primarily because of just how fast it is.
- oweiler 5y agoIt also has nice defaults and looks great without a single line of configuration.
- Barrin92 5y agofish + starship has been my setup for a while now and it's super pleasant because it pretty much does all I want out of the box
- nix23 5y agotcsh+starship is a pretty nice combination.