Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permit hiding status (exit) code when zero #5983

Open
Bilge opened this issue May 20, 2024 · 6 comments · May be fixed by #6010
Open

Permit hiding status (exit) code when zero #5983

Bilge opened this issue May 20, 2024 · 6 comments · May be fixed by #6010
Labels
✨ enhancement A new feature implementation.

Comments

@Bilge
Copy link

Bilge commented May 20, 2024

Feature Request

Is your feature request related to a problem? Please describe.

There seems to be no way to hide the zero exit code from the status module. There is the maybe_int variable, but this poorly-documented feature hides more than just the zero (0) exit status; at the least it also hides statuses 1 and 2 also. I only want to hide the exit status when it is zero and nothing else.

Describe the solution you'd like

Probably a new variable that is simply not set when the exit status is zero.

Describe alternatives you've considered

???

@Bilge Bilge added the ✨ enhancement A new feature implementation. label May 20, 2024
@HenningCode
Copy link

Hey could you share you status config? I think it you set the success_symbol="" it should be hidden when the exit code is zero.

This works for me:

[status]
format='-\[[$int]($style)\]'
success_symbol=''
style="red"
disabled=false

@Bilge
Copy link
Author

Bilge commented Jun 2, 2024

That's a curious quirk, but I want a success symbol.

[status]
disabled = false
success_symbol = '[](fg:color_green bg:color_bg1 bold)'
style = 'bg:color_bg1'
format = '[$symbol$maybe_int]($style red)'

I am using $maybe_int for now, to hide the zero exit code, but it also hides other (non-zero) codes (which is bad).

@HenningCode
Copy link

HenningCode commented Jun 2, 2024

Okay, I don't quite understand what you are trying to achieve

Could you perhaps share a screenshot of the part you want to remove and the part you want displayed?

@Bilge
Copy link
Author

Bilge commented Jun 2, 2024

Brotherman, this is not a particularly difficult concept, so let me break it down one last time:

  1. When non-zero show code.
  2. When zero hide code.
  3. Always show a symbol (tick or cross).

It's just that easy. Except it isn't, because it's unsupported.

@HenningCode
Copy link

HenningCode commented Jun 3, 2024

@Bilge
Ok I think I got it now. I will create a PR that fixes this.
grafik

@sjsepan3
Copy link

sjsepan3 commented Jun 29, 2024

That's a curious quirk, but I want a success symbol.

[status]
disabled = false
success_symbol = '[](fg:color_green bg:color_bg1 bold)'
style = 'bg:color_bg1'
format = '[$symbol$maybe_int]($style red)'

I am using $maybe_int for now, to hide the zero exit code, but it also hides other (non-zero) codes (which is bad).

@Bilge Is this the effect you are going for?
sjsepan pastel-powerline
(screenshot from my Nov '22 commit of my .toml file)
And here is how I've been doing it.


[($status)](bg:#86BBD8)\
[$character](bg:#86BBD8)\
...
[character] # The name of the module we are configuring is "character"
success_symbol = "[](fg:green bg:#86BBD8)" 
error_symbol = "[✘](fg:red bg:#86BBD8)"
...
[status]
disabled = false
format = '[\[$status:$common_meaning\] ](fg:red bg:#86BBD8)'

Example at https://gitlab.com/sjsepan/sjsepan.pastel-powerline
If I'm misunderstanding, I apologize.

@HenningCode will this PR affect existing code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ enhancement A new feature implementation.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants