I would be very curious to see an age demographic chart of people using e.g. Starship. Personally, over time, I have stopped caring too much about prompt customization. I concluded that, no matter how carefully you curate your prompt, 90% of the information shown will be irrelevant 90% of the time*. After a while, your brain will start perceiving this as visual clutter and filter it out, to the point you may even for…
As a counterpoint, one of the most useful customizations I've made to my prompt is to emit the exit status of the prior command. Knowing that something failed is a useful signal, esp. when sometimes the thing failing just fails to emit any output that indicates that it failed. I only emit it if the prior command fails, too, so it doesn't clutter things the 90% of the time things are working. » true » false (last comm…
Starship: A minimal, fast, and customizable prompt for any shell
151–160 of 216 posts
Re: Starship: A minimal, fast, and customizable prompt for any shell
#152I like maximalist prompts, and indeed Starship is what Shell Bling Ubuntu [1] installs on a new dev machine. But they're not everyone's cup of tea. If I wanted to recommend to someone the min-maxed, highest density thing they could add to their prompt, it would simply be the time your current prompt appeared + the amount of time the last command you ran took. These two pieces of information together make it very easy…
Re: Starship: A minimal, fast, and customizable prompt for any shell
#153Given that I do like my shiny prompt, which shows me:
The result of the last command (in green, red, or purple)
user@host:currentDirectory
current branch, if in a repo
with the last line showing summary git status, if in a repo, and background jobs, I suspect I might be their market, but I cannot see a why anywhere.(Green: Last command good, e.g., exit 0) (Red: Last command non-zero exit, with a special indicator if it was interrupted) (Purple: Last command suspended, and few other things)
Re: Starship: A minimal, fast, and customizable prompt for any shell
#154I like maximalist prompts, and indeed Starship is what Shell Bling Ubuntu [1] installs on a new dev machine. But they're not everyone's cup of tea. If I wanted to recommend to someone the min-maxed, highest density thing they could add to their prompt, it would simply be the time your current prompt appeared + the amount of time the last command you ran took. These two pieces of information together make it very easy…
You could probably (I haven’t tested it) append the run time as a comment to the history using something like PROMPT_COMMAND and `history -r <(…)`, instead of cluttering the prompt with it. And the start time is already in the history, using HISTTIMEFORMAT.
int history_write_timestamps
If non-zero, timestamps are written to the history file, so they can be preserved between sessions. The default value is 0, [...]
So this isn't true by default on many machines unless it is explicitly turned on. Once you do have it on, of course, then I agree.Re: Starship: A minimal, fast, and customizable prompt for any shell
#155What am I missing? I went to the site, but I can find nothing to suggest why I might want to use this. Are there examples that I've missed, likely owing to having been heads down chasing a pernicious heisenbug all day? Given that I do like my shiny prompt, which shows me: The result of the last command (in green, red, or purple) user@host:currentDirectory current branch, if in a repo with the last line showing summar…
Re: Starship: A minimal, fast, and customizable prompt for any shell
#156Earlier quoted context omitted.
When you’re debugging, especially a complex system, especially during an outage or postmortem, understanding when your commands executed relative to when your log lines appeared is really helpful.
That's a good reason to have timestamps in the history, which you should. Something like export HISTFILESIZE= export HISTSIZE= export HISTTIMEFORMAT="[%F %T] " shopt -s histappend really ought to be default in bash. It's not as clear why you need it in the interactive prompt.
It sounds silly, but it has saved my butt more than once. Especially if you have bugs that e.g. only show up once per hour on the hour, and are otherwise fine.
Re: Starship: A minimal, fast, and customizable prompt for any shell
#157Re: Starship: A minimal, fast, and customizable prompt for any shell
#158I would be very curious to see an age demographic chart of people using e.g. Starship. Personally, over time, I have stopped caring too much about prompt customization. I concluded that, no matter how carefully you curate your prompt, 90% of the information shown will be irrelevant 90% of the time*. After a while, your brain will start perceiving this as visual clutter and filter it out, to the point you may even for…
For a while, I tried a couple of Christmas tree prompts which included all kinds of condensed Git status and other bells and whistles, but eventually tired of them and settled on:
- Exit status of the previous command, if nonzero.
- Current time, HH:MM, 24 hour format.
- user@host, red if euid 0, green otherwise.
- Current directory, shortened if the path has three or more elements, with home directory recognition.
- Current directory, full path, echoed as hardstatus and hence appearing in the terminal window title.
- The name of the current branch if within a Git repo.
- Prompt character, dollar/hash sign.
All those elements are meaningful to me, inasmuch as I can quickly orient myself using that information and explore further if I notice anything out of the ordinary.
I'm pretty sure that megaprompt programs like Starship could produce the above, but I like obtaining a familiar prompt with a minimum of external dependencies, and so have written it all in Bash, then ported to Zsh and various Korn shells, which was quite tricky. It probably wouldn't work on Xenix 286, but anything newer has a fighting chance.
Re: Starship: A minimal, fast, and customizable prompt for any shell
#159Re: Starship: A minimal, fast, and customizable prompt for any shell
#160Earlier quoted context omitted.
You could probably (I haven’t tested it) append the run time as a comment to the history using something like PROMPT_COMMAND and `history -r <(…)`, instead of cluttering the prompt with it. And the start time is already in the history, using HISTTIMEFORMAT.
Per the Bash `history` manpage: int history_write_timestamps If non-zero, timestamps are written to the history file, so they can be preserved between sessions. The default value is 0, [...] So this isn't true by default on many machines unless it is explicitly turned on. Once you do have it on, of course, then I agree.