Skip to content

Conversation

@manandhar01
Copy link
Contributor

Summary

This PR fixes a small bug in the __powerline_last_status_prompt function where
an error would occur if the function was called without an argument.

image

Changes

  • Replaced ${1?} with ${1:-0} to provide a safe default value when $1 is unset.
  • This ensures that the function no longer throws an error if no argument is passed.

Why

The previous implementation used ${1?}, which causes error to show up before each prompt
if $1 is not set. This could break the prompt in certain cases. By switching to
${1:-0}, the function now defaults to 0 and continues safely.

Testing

  • Verified that the function behaves correctly when called with and without arguments.
  • Prompt now displays the correct status without errors.

Copy link
Contributor

@seefood seefood left a comment

Choose a reason for hiding this comment

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

seems legit. how did it work this far?

@seefood seefood self-assigned this Aug 23, 2025
@seefood seefood merged commit 8474502 into Bash-it:master Aug 23, 2025
6 checks passed
@manandhar01
Copy link
Contributor Author

seems legit. how did it work this far?

No idea. It was working fine on my old system. Installed this on my new system yesterday and the error started popping up. At first I thought there was something wrong with my bashrc but it was fine. I then followed the code and ended up here.

@manandhar01 manandhar01 deleted the bash-1-parameter-not-set-issue branch August 24, 2025 12:47
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