Skip to content

Conversation

@Maritsu
Copy link
Contributor

@Maritsu Maritsu commented Jan 1, 2026

related: none

Adds an option to display the exit status if the last command failed. Includes an extra option to convert signal numbers (129 and above) to their respective names (SIGHUP, SIGINT, SIGQUIT, etc.), as well as two configuration options.

How to test pre-release?

☠️ Feature can be unstable and break your prompt!

fisher install Maritsu/pure@feature/display-exit-code
set --universal pure_show_exit_status true # Show non-zero statuses
set --universal pure_convert_exit_status_to_signal true # Convert signal numbers to names

Specs

New config in conf.d/pure.fish

_pure_set_default pure_show_exit_status false
_pure_set_default pure_convert_exit_status_to_signal false
_pure_set_default pure_symbol_exit_status_prefix "|"
_pure_set_default pure_symbol_exit_status_separator "|"
_pure_set_default pure_color_exit_status pure_color_danger

Documentation

Usage

  • Enable feature:
set --universal pure_show_exit_status true
  • Enable signal number conversion:
set --universal pure_convert_exit_status_to_signal true

Acceptance Checks

  • Documentation is up-to-date:
    • Add entry in feature list of README.md ;
    • Add entry in features' overview in docs/ ;
    • Add section in feature list to document
      • Features' flag ;
      • Prompt symbol ;
  • Default are defined in conf.d/pure.fish for:
    • Feature flag ;
    • Symbol ;
  • Tests are passing (I can help you 🤗 ):
  • Customization is available ;
  • Feature is implemented.

@Maritsu Maritsu changed the title Feature/display exit code feat: add option to display exit status Jan 1, 2026
…Linux OS

Rewrite the expected value for "pipeline of the first 15 signals, conversion enabled" to account for the difference in signal names between operating systems.
@Maritsu Maritsu force-pushed the feature/display-exit-code branch from 52d71f0 to 34407d7 Compare January 5, 2026 11:33
@Maritsu
Copy link
Contributor Author

Maritsu commented Jan 5, 2026

Just pushed a fix for the failing test, sorry for having overlooked it!

Copy link
Member

@edouard-lopez edouard-lopez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!
Could you share some screenshots ?

I added some todo, will check again later as I’m not on a computer

# true - separate prompt character
_pure_set_default pure_separate_prompt_on_error false

# Prefix the prompt with a list of exit statuses ($pipestatus) if at least one is non-zero
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: Variable $pipestatus was introduced in Fish 3.1b1, our minimal supported version is 3.3.1

before_each
@test "_pure_prompt_exit_status: pipeline of the first 15 signals, conversion enabled" (
_pure_unmock _pure_set_color # enable colors
set --local statuses (seq 129 143)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thought: I see you are limiting to POSIX-compliant UNIX systems codes. That’s fine by me, we can add more when use cases arise.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much as I'd have liked that to be the case, I just pulled up the kernel manpage you linked and thought "I've never seen most of these statuses, I think 15 is going to be good enough" 😅

@Maritsu
Copy link
Contributor Author

Maritsu commented Jan 5, 2026

Thanks for the PR! Could you share some screenshots ?

sure thing, here you go :) i used my personal config; if you'd like me to retake them with the defaults, just say
image
image
image
image
image

@edouard-lopez
Copy link
Member

Thanks for the screenshots.

Question: Did you get inspiration from another theme or tool ?
Thought: Did you try using a prefix to identify this segment? Like for python virtualenv or root context

…nges

Refs: pure-fish#395

test(_pure_prompt_exit_status): add expected output description to test titles

test(_pure_prompt_exit_status): refactor signal conversion test to target the intended CI environment only
@Maritsu
Copy link
Contributor Author

Maritsu commented Jan 6, 2026

Question: Did you get inspiration from another theme or tool ?

I learned of $pipestatus's existence by stumbling upon Hydro, but decided to stay close to the vanilla Fish prompt as far as the default configuration goes.

Thought: Did you try using a prefix to identify this segment? Like for python virtualenv or root context

Not really, I think the display is intuitive enough without any prefix but I could add one in if you wish.

@edouard-lopez
Copy link
Member

Please add a pure_symbol_exit_status_prefix with a default value of "|", so new segment follow the same pattern (prefix then data).

@edouard-lopez
Copy link
Member

I pushed a PR to update the doc about feature design based on our exchange #396

@Maritsu
Copy link
Contributor Author

Maritsu commented Jan 6, 2026

Please add a pure_symbol_exit_status_prefix with a default value of "|", so new segment follow the same pattern (prefix then data).

Done, here's how it looks now.
image

@edouard-lopez edouard-lopez changed the title feat: add option to display exit status feat: add option to display exit pipe status Jan 7, 2026
@edouard-lopez edouard-lopez merged commit e078147 into pure-fish:master Jan 7, 2026
7 of 8 checks passed
edouard-lopez pushed a commit that referenced this pull request Jan 7, 2026
…nges

Refs: #395

test(_pure_prompt_exit_status): add expected output description to test titles

test(_pure_prompt_exit_status): refactor signal conversion test to target the intended CI environment only
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants