Earlier quoted context omitted.
I kinda like using tooling with 40 years of refinement. Is it perfect? No. Do I need to resize a window with a progress bar? No. Would it be nice? Yeah, I guess. Am I underestimating the benefits? Almost certainly. But what are the other sharp edges that come with the shiny new thing? Would it be an electron app? Yes, probably. Would it work? Maybe, in a couple years. There would be some major bugs first, and a lot o…
I definitely enjoy the continuity, call me small-minded but I don’t want to see this stuff revolutionized either. Maybe because I came up in the 90s and am nostalgic for the VT220 etc, I don’t know. And it’s weird because I have little or no love for other old school stuff.
Colorize Your CLI
81–90 of 124 posts
Re: Colorize Your CLI
#82As developer I think we use too many colors everywhere. It is really necessary? Some terminals looks like a rainbow festival. A color for the user, a different color for the hostname, another one for the git branch... It is a directory? Let's add a new color. I think is too much. I like to use themes like minimal-theme [ https://github.com/anler/minimal-theme ]. My eyes appreciate it.
I agree. How about just reading the text? The human brain is excellent at quickly skimming through text and recognizing patterns. We don't need colors.
Re: Colorize Your CLI
#83I do like to have colorized output for my interactive CLI tools, but I will never understand a prompt other than "$" or "#". Do people really need to continuously see all the noise like the host name, their username, the working directory, the date, or even their current branch? Is hostname, whoami, pwd, date, git branch, and git status really to cumbersome? At least with hostname and branch I'm usually piping to pbc…
If you do work on a number of different machines, in production and in dev, knowing what host you're on, what directory you're in, etc. helps avoid errors like killing a process in prod when you thought you were in dev. While writing code, it's helpful to know what branch you're on with git, so you don't accidentally commit code to the wrong branch, etc. I typically have something like 30-40 terminals open at a time,…
Re: Colorize Your CLI
#84I do like to have colorized output for my interactive CLI tools, but I will never understand a prompt other than "$" or "#". Do people really need to continuously see all the noise like the host name, their username, the working directory, the date, or even their current branch? Is hostname, whoami, pwd, date, git branch, and git status really to cumbersome? At least with hostname and branch I'm usually piping to pbc…
### PROMPT ###
function user_host_pwd() {
printf "%c " '-'
user -n
printf "%c" '@'
violet
printf "%s" "${HOSTNAME%%.*}"
normal
printf "%c" ':'
path "${PWD}"
}
-() { user_host_pwd ; }
prompt_command() {
local current="$USER@$HOSTNAME:$PWD"
local last_cmd
if [ "$current" == "$USER_HOSTNAME_PWD" ]; then
last_cmd="#$(history | tail -n 1 | sed -e 's/.*[0-9] //' | cut -d ' ' -f 1)"
for cmd in $COMMANDS_USER_HOST_PWD_PROMPT
do
if [ "#${cmd}" == "$last_cmd" ]; then
USER_HOSTNAME_PWD=""
break
fi
done
fi
if [ "$current" != "$USER_HOSTNAME_PWD" ]; then
export USER_HOSTNAME_PWD="$current"
user_host_pwd
fi
}
COMMANDS_USER_HOST_PWD_PROMPT="cd ssh sudo su login $(sed -e '/^#.*$/d' -e '/^$/d' -e 's@^.*/@@' /etc/shells | uniq | xargs)"
PROMPT_COMMAND=prompt_command
PS1='$ '
[ "`id -u`" -eq 0 ] && PS1='# 'Re: Colorize Your CLI
#85I'd much prefer consistent and predictable information conveyance. Ie, I don't need Midnight Commander to be lit up like a christmas tree because I know immediately what information is displayed in its tables and panes.
Re: Colorize Your CLI
#86I feel like we need a complete rewrite of terminal emulators/bash/whatever. It should be super easy to make a CLI with nice colors, good loading icons, etc. without having to deal with all kinds of color codes and cursor movement. When I press "enter" while a script is showing some progress bar, or resize the terminal window, it should handle it nicely like every other application. I use the command line whenever pos…
Re: Colorize Your CLI
#87Earlier quoted context omitted.
> since my FreeBSD servers don't have a termcap file for alacritty, when I ssh into my FreeBSD servers my backspace key doesn't work (along with a lot of other things). A hack I've got in .zshrc for this problem: function ssh { if [[ "${TERM}" = alacritty ]]; then env TERM=xterm-256color /usr/bin/ssh "$@" else /usr/bin/ssh "$@" fi }
Installing the terminfo also works: https://github.com/alacritty/alacritty/blob/master/INSTALL.m...
Re: Colorize Your CLI
#88Earlier quoted context omitted.
I definitely enjoy the continuity, call me small-minded but I don’t want to see this stuff revolutionized either. Maybe because I came up in the 90s and am nostalgic for the VT220 etc, I don’t know. And it’s weird because I have little or no love for other old school stuff.
I would be happy if I never had to write a flaky text parser, for some command line tool, output again.
Re: Colorize Your CLI
#89I feel like we need a complete rewrite of terminal emulators/bash/whatever. It should be super easy to make a CLI with nice colors, good loading icons, etc. without having to deal with all kinds of color codes and cursor movement. When I press "enter" while a script is showing some progress bar, or resize the terminal window, it should handle it nicely like every other application. I use the command line whenever pos…
Why does a CLI need colours and icons? OK...colours have some value, but icons? Serious question.
Icons? It's easier to show information in a smaller area when you can use the spot a character would take with an emoji or equivalent.
Re: Colorize Your CLI
#90Earlier quoted context omitted.
Why does a CLI need colours and icons? OK...colours have some value, but icons? Serious question.
On a basic level, a CLI with color adds visual information that's easily seen at a glance. In this example blog post, the author shows how adding color to `df` resulted in an immediate visual distinction between mostly empty and mostly occupied space, which would normally require scanning a column to find. Icons? It's easier to show information in a smaller area when you can use the spot a character would take with a…