mirror of
https://github.com/starship/starship.git
synced 2024-11-23 00:33:16 +01:00
perf: Skip unnecessary indirection in starship init zsh (#5322)
Skip unnecessary indirection in starship init zsh The installation instructions indicate that one should add this snippet to zsh's configuration: eval "$(starship init zsh)" The command `starship init zsh` prints a little shell script for zsh to execute: > starship init zsh source <(/usr/bin/starship init zsh --print-full-init)% Running `starship init zsh --print-full-init` prints yet another script that zsh executes. There is an intermediate step that seems redundant; starship prints a script for zsh to execute, and this script prints another script for zsh to execute. This commit skips the intermediate execution and prints the final script in `starship init`. This is backwards compatible and does not require any changes in the installation instructions, so it could be release without a major version bump. Note that it would still be possible to update the installation instructions to `source <(starship init zsh)`; this patch works with both `source` and `eval`. Picking the most performant one is beyond this scope of this commit. See: https://github.com/starship/starship/issues/2637
This commit is contained in:
parent
1884409c56
commit
5ca8daacd4
@ -153,10 +153,7 @@ pub fn init_stub(shell_name: &str) -> io::Result<()> {
|
||||
"#,
|
||||
starship.sprint_posix()?
|
||||
),
|
||||
"zsh" => print!(
|
||||
r#"source <({} init zsh --print-full-init)"#,
|
||||
starship.sprint_posix()?
|
||||
),
|
||||
"zsh" => print_script(ZSH_INIT, &starship.sprint_posix()?),
|
||||
"fish" => print!(
|
||||
// Fish does process substitution with pipes and psub instead of bash syntax
|
||||
r#"source ({} init fish --print-full-init | psub)"#,
|
||||
|
Loading…
Reference in New Issue
Block a user