Skip to content

Conversation

@Anthuang
Copy link
Contributor

First PR here, let me know if anything can be improved!

Description

Currently, if there are 0 jobs running then the jobs module doesn't show anything. However, if a negative threshold is specified (user wants to explicitly see that there are 0 jobs running), then it should show 0.

Closes #2610

How Has This Been Tested?

  • I have tested using MacOS
  • I have tested using Linux
  • I have tested using Windows

Checklist:

  • I have updated the documentation accordingly.

@vladimyr
Copy link
Member

vladimyr commented Apr 20, 2021

As mentioned here #2610 (comment) instead of allowing a negative threshold, allow setting zero as a threshold.
Also, check src/modules/cmd_duration.rs for inspiration and log negative threshold value using log::warn!.

@andytom andytom changed the title Handle zero jobs with negative thresholds fix(jobs): Handle zero jobs with negative thresholds Apr 20, 2021
@vladimyr vladimyr changed the title fix(jobs): Handle zero jobs with negative thresholds fix(jobs): Handle zero jobs with zero thresholds Apr 20, 2021
Copy link
Member

@vladimyr vladimyr left a comment

Choose a reason for hiding this comment

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

First PR here, let me know if anything can be improved!

Sure, do more great PRs like this one! ❤️

LGTM

@vladimyr
Copy link
Member

Actually, I forgot, docs need to get updated too 🙃

@Anthuang
Copy link
Contributor Author

First PR here, let me know if anything can be improved!

Sure, do more great PRs like this one! ❤️

LGTM

Thank you for the reviews!! And I just added the docs, lmk if it sounds good or if I should change the wording

@andytom andytom merged commit 3f2d6cc into starship:master Apr 20, 2021
@andytom
Copy link
Member

andytom commented Apr 20, 2021

Thank you @Anthuang for your contribution and thank you @vladimyr for the review.

frezbo added a commit to frezbo/ansible-workstation that referenced this pull request Apr 22, 2021
DavidSmith166 pushed a commit to DavidSmith166/starship that referenced this pull request Apr 24, 2021
* Handle zero jobs with negative thresholds

* Allow for zero threshold only

* Log when threshold is less than zero

* Address comments

* Add docs
@ndreas ndreas mentioned this pull request May 4, 2021
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.

[jobs] Cannot take negative value (zero jobs not shown)

3 participants