Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a "prompt_login" helper function #7932

Merged
merged 1 commit into from Apr 30, 2021
Merged

Conversation

faho
Copy link
Member

@faho faho commented Apr 15, 2021

Description

This prints a description of the "host". Currently that's

(chroot:debianchroot) $USER@$hostname

with the chroot part when needed. That means instead of having one "debian chroot" prompt, we support that out of the box.

This also switches the default and terlar prompts to use it, the other
prompts have slightly different coloring or logic here. It would be possible to allow that by adding options to prompt_host.

Part of #7884.

TODOs:

  • Changes to fish usage are reflected in user documentation/manpages.
  • Tests have been added for regressions fixed
  • User-visible changes noted in CHANGELOG.rst

Questions:

  • Is this wanted at all? Like I said I think having debian chroots off in a separate prompt just results in nobody using it because they would have to change the prompt in the chroot (which means allowing for fish_config to work there!), so the alternative seems to be not supporting that at all
  • What about the name? prompt_host sounds like it might be prompt_hostname, but prompt_chroot_user_at_host is a bit wordy. prompt_machine perhaps?
  • Support for things other than the debian chroot thing - do other systems have something similar? How about virtual machines? We already color the host differently if it's ssh.

@faho faho added this to the fish 3.3.0 milestone Apr 15, 2021
@krobelus
Copy link
Member

(#6398 had a more comprehensive solution, using systemd-detect-virt and Debian's ischroot, at the cost of adding forks at startup)

Not a strong opinion but I'd be fine with dropping the debian chroot prompt. Or replace it with the generic systemd-detect-virt --chroot. (We don't care too much about containers/virtualization, because they hopefully have a different hostname from the host, but the chroot one can be nice.) Though I don't know how often this is useful in practise, is chroot still commonly used (over containers)?.

Distribution integration is a bit lacking in general; I wouldn't be surprised if $PATH was not set up correctly when using fish as login shell on a Debian (chroot) system. That would be nice to have fixed but it's not really within our scope.

prompt_login would be an alternative name, if we need it.

@faho faho force-pushed the prompt-machine branch 2 times, most recently from 35ee7dd to 0f1fbea Compare April 30, 2021 14:54
This prints a description of the "host". Currently that's

`(chroot:debianchroot) $USER@$hostname`

with the chroot part when needed.

This also switches the default and terlar prompts to use it, the other
prompts have slightly different coloring or logic here.
@faho faho changed the title Add a "prompt_host" helper function Add a "prompt_login" helper function Apr 30, 2021
@faho
Copy link
Member Author

faho commented Apr 30, 2021

Alright, renamed to prompt_login. It's not perfect, but at least it doesn't have the host/hostname confusion.

@faho faho merged commit 2cea5b8 into fish-shell:master Apr 30, 2021
@faho faho deleted the prompt-machine branch July 29, 2021 15:57
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants