starship: skip one program invocation on each shell init (#2862)
The code that is being evaled without the `--print-full-init` flag is this: ```sh __main() { local major="${BASH_VERSINFO[0]}" local minor="${BASH_VERSINFO[1]}" if ((major > 4)) || { ((major == 4)) && ((minor >= 1)); }; then source <(/nix/store/...-starship-1.3.0/bin/starship init bash --print-full-init) else source /dev/stdin <<<"$(/nix/store/...-starship-1.3.0/bin/starship init bash --print-full-init)" fi } __main unset -f __main ``` This code checks for bash version >= 4.1 , which has been released in 2009. Since this version is widely unavailable in nixpkgs, we can skip one program invocation and directly call `starship init bash --print-full-init`.
This commit is contained in:
parent
e361373b5f
commit
3071ea205d
|
@ -100,7 +100,7 @@ in {
|
||||||
|
|
||||||
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
|
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
|
||||||
if [[ $TERM != "dumb" && (-z $INSIDE_EMACS || $INSIDE_EMACS == "vterm") ]]; then
|
if [[ $TERM != "dumb" && (-z $INSIDE_EMACS || $INSIDE_EMACS == "vterm") ]]; then
|
||||||
eval "$(${starshipCmd} init bash)"
|
eval "$(${starshipCmd} init bash --print-full-init)"
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue