Open tomjn opened 1 year ago
+1 for this, its useful for me personally
@pentatonicfunk is this a vote for starship or a vote for the PHP version in the prompt specifically? I've been hesitant to suggest changes to the prompt in the past as it's something very personal to each developer, but I realise there are usability concerns unique to VVV
We already print some data on Vagrant to help debugging and I don't see an issue on the message at the login similar. Some VPS and hostings already do that.
Maybe it's the case to do a recap of what is enabled like for the extensions?
maybe it's a text message that we can generate on provisioning to simplify it.
true, but what prompted this was that someone changed into a site that used PHP 8 and expected that php --version
would print 8.0 not 7.4 in that folder. There was nothing to indicate the current PHP version, or that it had not changed.
Starship has this prompt for me locally:
We could use that project, or we could use something else to achieve the same goal, but it is helpful to see the current PHP version inside PHP project folders
It may even be helpful to indicate the current site, e.g. if you go into /srv/www/wordpress-one/public_html
to see that you're in wordpress-one
, though that is a little out of scope of this issue
If we did use starship, I'd suggest the no nerd font preset or the plaintext symbols:
https://starship.rs/presets/no-nerd-font.html
https://starship.rs/presets/plain-text.html
Starship is the minimal, blazing fast, and extremely customizable prompt for any shell! Shows the information you need, while staying sleek and minimal. Quick installation available for Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh, Cmd, and Powershell.
Starship is the minimal, blazing fast, and extremely customizable prompt for any shell! Shows the information you need, while staying sleek and minimal. Quick installation available for Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh, Cmd, and Powershell.
Ahhh ok you were talking about the statusline/prompt in the bash terminal not on the hello message by SSH.
I use on my workstation this https://github.com/petobens/trueline (pure bash) loaded on my bashrc with custom settings. Maybe we can use this or similar as they simplify a lot of things and put our script to generate the text like php version.
GitHubFast and extensible bash powerline prompt with true color and fancy icon support - GitHub - petobens/trueline: Fast and extensible bash powerline prompt with true color and fancy icon support
Starship has a powerline style prompt too, perhaps we should provide this as a default and allow configuration via config.yml
?
shell:
prompt: starship
or
shell:
prompt: trueline
This also puts a place we can have options for the welcome message e.g. if people would prefer not to have one, or want a slimmed down message.
Would we want to install them all and have script files that set up the prompt, then in .bashrc
include those conditionally based on the config value? e.g. source /srv/provision/core/prompts/starship.sh
etc
We might also want to add a secondary folder to check for so that users can add their own via extensions, then we'd only need to bundle a single option in VVV core
Maybe this can be an extension and not native in VVV? In this way can be customized?
About shartship or trueline to me the solution is not a problem. The important part that is easy to update as we want just to show the php version and the git branch.
Because it is possible to share the host user .bashrc with ssh https://serverfault.com/questions/400522/how-to-use-a-custom-bashrc-file-on-ssh-login so I don't think that we want to complicate things too much.
Server FaultI've found that with the new company I'm working with I often have to access linux servers with relatively short lifetimes. On each of these servers I have an account, but whenever a new one is cre...
Because it is possible to share the host user .bashrc with ssh https://serverfault.com/questions/400522/how-to-use-a-custom-bashrc-file-on-ssh-login so I don't think that we want to complicate things too much.
That just copies bashrc into the remote server which wouldn't work if it's including other files. It would also replace any VVV specific things we have. Additionally, vagrant ssh
may not be using the ssh
command as it uses netssh internally so you're using an interactive ruby shell.
I mention starship or another similar prompt as it's a package that does everything out of the box and maintained by other people. The alternative is we modify the prompt we already have but then we have a bespoke prompt that we need to maintain ourselves.
The other problem is that any extension would need to reach into the .bashrc
file and insert its own code to override the prompt, which sounds pretty terrible. I don't like the idea of provisioners doing string manipulation on .bashrc
or .bash_profile
and appending lines then trying to remove or replace them. We already have the problem that a starship extension has no way to cleanup and uninstall itself if the user decided they didn't like it, so there needs to be some sort of system
Noting that auto-switching PHP version via direnv
might be doable in the standard custom template repo, might be worth exploring the tradeoffs or if it can be added via the VVV core site provisioner
We should show the PHP version in the terminal prompt when you SSH into the VM so it's clear which version is being used. This also avoids confusion when people go to their site and expect PHP to be the version from the
config.yml
file and for the version to have automatically switched ( we don't have anything that does that currently ).I use starship locally which does this and also prints out info on ruby/node etc depending on the current project folder, and some basic git info. Perhaps that would be a useful addition?