Open acantepie opened 3 years ago
Change it how exactly?
I have installed pure theme on my docker image, i got this prompt :
docker@58862c73050e ~
❯
I want hide the hostname part to display only "docker ~"
Per https://github.com/sindresorhus/pure/pull/564#issuecomment-774709842, we are open to adding an option for this.
@sindresorhus Can't you just hide hostname if we are on container ?
Replace line on file : https://github.com/sindresorhus/pure/blob/main/pure.zsh
# Show `username@host` if inside a container and not in GitHub Codespaces.
[[ -z "${CODESPACES}" ]] && prompt_pure_is_inside_container && username='%F{$prompt_pure_colors[user]}%n%f'"$hostname"
By
# Show `username@host` if inside a container and not in GitHub Codespaces.
[[ -z "${CODESPACES}" ]] && prompt_pure_is_inside_container && username='%F{$prompt_pure_colors[user]}%n%f'
@acantepie while I can appreciate the (somewhat) aesthetic improvement, how would you differentiate between two open containers? We'd also have to adjust the logic for the root user which, without changes, would display the hostname. Removing the hostname there would IMO also create a color-imbalance (only the white username).
Indeed, I have finally define a custom hostname on my docker-compose.
@sindresorhus Is it possible to always show username@hostname, even when I have not ssh'ed into a machine?
@reportaman Anything is possible by modifying the prompt yourself, but it's not something we plan to support built-in.
@sindresorhus what's the action-point for this issue? I'm not entirely sure if it's adding an option for disabling the showing of @hostname
, or to detect hostname == hostname
between host and container (as per https://github.com/sindresorhus/pure/pull/564#issuecomment-774739621)?
Of the two, I think only the former is possible.
@mafredri The former.
@sindresorhus I would second @poetaman's ask for an option to always show the user@host
in the prompt (where it normally would be). In a hasty look, I don't see a way other than to rewrite the function (i.e., prompt_pure_state_setup
).
I am happy to open up a new issue and/or submit a PR.
I want to change user@hostname on prompt , is it possible to doing that ?