jorgebucaran / hydro

Ultra-pure, lag-free prompt with async Git status—just for Fish
MIT License
697 stars 53 forks source link

Hide full path of last command with exit code != 0 #23

Closed bwolf closed 3 years ago

bwolf commented 3 years ago

Hydro extends the prompt with the full path of the last command that failed (exit code != 0). This path is for NixOS users very long (a path like /nix/store/p4i6hi976q7csprsb35d4wx797wzpri2-lorri-keep-env-hack-nix-shell) and I personally would like to hide the full path. Instead it would be enough to display the name of last command or hide it completly. Is there any option to configure this, or is a change required to implement this?

jorgebucaran commented 3 years ago

Hydro only shows the exit status AFAIC. Can you share a screenshot?

~/C/hydro main ❱ foo
fish: Unknown command: foo
~/C/hydro main [127] 
bwolf commented 3 years ago

Example with fish shell 3.2.2 and Hydro a5877e9ef76b3e915c06143630bffc5ddeaba2a1 which is the commit from 2021-05-15:

~/s/p/p/project master ❱ mvn clean test
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.892 s
[INFO] Finished at: 2021-11-01T19:08:03+01:00
[INFO] ------------------------------------------------------------------------
~/s/p/p/project master /nix/store/dj7xwrgp4kjl36f09yyqsl1ay8glxk5b-lorri-keep-env-hack-nix-shell 1.8s [1]

Note: this only happens when running a command in a directory which is baked by direnv and a shell.nix Nix environment. Running it outside, say in ~, only the exit code is printed.

~ ❱ zsh -c 'sleep 2; exit 0'
~ 2s ❱ zsh -c 'sleep 2; exit 1'
~ 2s [1]
jorgebucaran commented 3 years ago

Hydro only prints the error code when exit code != 0. This must be the git prompt behaving erratically.

https://github.com/jorgebucaran/hydro/blob/cf7b19842f03bc4df27f9281badfc2828c02b56a/conf.d/hydro.fish#L52-L85

brandonpittman commented 3 years ago

I often see error codes like [0|1]. Can’t remember if there’s a type of command that consistently causes that though.

bwolf commented 3 years ago

Ok thanks, I assume this has nothing to do with Hydro.

jorgebucaran commented 3 years ago

@brandonpittman Yup. That's the pipestatus. See https://fishshell.com/docs/current/language.html#variables-status.

brandonpittman commented 3 years ago

@jorgebucaran Never knew about that. Thanks for the link.

okkdev commented 2 years ago

Sorry for commenting on a closed issue, but did you find a solution for this issue? @bwolf

bwolf commented 2 years ago

@okkdev unfortunately not.