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

fix: only fill the bar for spinners in Finish() #188

Merged
merged 2 commits into from
Jun 6, 2024

Conversation

black-night-heron
Copy link
Contributor

#187

I apologize for the oversight in #182 regarding the spinner scenario.

For spinner types, we should not call Set(max) in Finish() because:

  1. The spinner's max is set to the width, so calling Set(max) results in incorrect currentBytes.
  2. In Add(num), if currentNum < max, currentNum = (currentNum + num) % max, preventing the spinner from finishing.

A simple solution is to update currentBytes for non-spinners.

@schollz schollz merged commit 1e0fedf into schollz:main Jun 6, 2024
1 check passed
renovate bot referenced this pull request in nobl9/sloctl Jun 9, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[github.com/schollz/progressbar/v3](https://github.com/schollz/progressbar)
| `v3.14.3` -> `v3.14.4` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fschollz%2fprogressbar%2fv3/v3.14.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fschollz%2fprogressbar%2fv3/v3.14.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fschollz%2fprogressbar%2fv3/v3.14.3/v3.14.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fschollz%2fprogressbar%2fv3/v3.14.3/v3.14.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>schollz/progressbar
(github.com/schollz/progressbar/v3)</summary>

###
[`v3.14.4`](https://github.com/schollz/progressbar/releases/tag/v3.14.4)

[Compare
Source](https://github.com/schollz/progressbar/compare/v3.14.3...v3.14.4)

#### What's Changed

- fix: only fill the bar for spinners in Finish() by
[@&#8203;black-night-heron](https://github.com/black-night-heron) in
[https://github.com/schollz/progressbar/pull/188](https://github.com/schollz/progressbar/pull/188)

**Full Changelog**:
schollz/progressbar@v3.14.3...v3.14.4

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 10pm every weekday,before 5am
every weekday,every weekend" (UTC), Automerge - At any time (no schedule
defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/nobl9/sloctl).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zOTMuMCIsInVwZGF0ZWRJblZlciI6IjM3LjM5My4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJnb2xhbmciLCJyZW5vdmF0ZSJdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
kodiakhq bot referenced this pull request in cloudquery/plugin-pb-go Jul 1, 2024
…#351)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/schollz/progressbar/v3](https://github.com/schollz/progressbar) | require | patch | `v3.14.2` -> `v3.14.4` |

---

### Release Notes

<details>
<summary>schollz/progressbar (github.com/schollz/progressbar/v3)</summary>

### [`v3.14.4`](https://github.com/schollz/progressbar/releases/tag/v3.14.4)

[Compare Source](https://github.com/schollz/progressbar/compare/v3.14.3...v3.14.4)

#### What's Changed

-   fix: only fill the bar for spinners in Finish() by [@&#8203;black-night-heron](https://github.com/black-night-heron) in [https://github.com/schollz/progressbar/pull/188](https://github.com/schollz/progressbar/pull/188)

**Full Changelog**: schollz/progressbar@v3.14.3...v3.14.4

### [`v3.14.3`](https://github.com/schollz/progressbar/releases/tag/v3.14.3)

[Compare Source](https://github.com/schollz/progressbar/compare/v3.14.2...v3.14.3)

#### What's Changed

-   fix error return by [@&#8203;ttmars](https://github.com/ttmars) in [https://github.com/schollz/progressbar/pull/175](https://github.com/schollz/progressbar/pull/175)
-   fix Finish() should update state.currentBytes by [@&#8203;black-night-heron](https://github.com/black-night-heron) in [https://github.com/schollz/progressbar/pull/182](https://github.com/schollz/progressbar/pull/182)
-   fix race condition when changing max by [@&#8203;mxey](https://github.com/mxey) in [https://github.com/schollz/progressbar/pull/183](https://github.com/schollz/progressbar/pull/183)
-   fix: make elapsedTime option work in non-spinner mode by [@&#8203;wjf3121](https://github.com/wjf3121) in [https://github.com/schollz/progressbar/pull/184](https://github.com/schollz/progressbar/pull/184)

#### New Contributors

-   [@&#8203;ttmars](https://github.com/ttmars) made their first contribution in [https://github.com/schollz/progressbar/pull/175](https://github.com/schollz/progressbar/pull/175)
-   [@&#8203;black-night-heron](https://github.com/black-night-heron) made their first contribution in [https://github.com/schollz/progressbar/pull/182](https://github.com/schollz/progressbar/pull/182)
-   [@&#8203;mxey](https://github.com/mxey) made their first contribution in [https://github.com/schollz/progressbar/pull/183](https://github.com/schollz/progressbar/pull/183)
-   [@&#8203;wjf3121](https://github.com/wjf3121) made their first contribution in [https://github.com/schollz/progressbar/pull/184](https://github.com/schollz/progressbar/pull/184)

**Full Changelog**: schollz/progressbar@v3.14.2...v3.14.3

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on the first day of the month" (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40MjEuMyIsInVwZGF0ZWRJblZlciI6IjM3LjQyMS4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJhdXRvbWVyZ2UiXX0=-->
kodiakhq bot referenced this pull request in cloudquery/cloudquery Jul 1, 2024
…#18437)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/schollz/progressbar/v3](https://github.com/schollz/progressbar) | require | patch | `v3.14.2` -> `v3.14.4` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency Dashboard for more information.

---

### Release Notes

<details>
<summary>schollz/progressbar (github.com/schollz/progressbar/v3)</summary>

### [`v3.14.4`](https://github.com/schollz/progressbar/releases/tag/v3.14.4)

[Compare Source](https://github.com/schollz/progressbar/compare/v3.14.3...v3.14.4)

#### What's Changed

-   fix: only fill the bar for spinners in Finish() by [@&#8203;black-night-heron](https://github.com/black-night-heron) in [https://github.com/schollz/progressbar/pull/188](https://github.com/schollz/progressbar/pull/188)

**Full Changelog**: schollz/progressbar@v3.14.3...v3.14.4

### [`v3.14.3`](https://github.com/schollz/progressbar/releases/tag/v3.14.3)

[Compare Source](https://github.com/schollz/progressbar/compare/v3.14.2...v3.14.3)

#### What's Changed

-   fix error return by [@&#8203;ttmars](https://github.com/ttmars) in [https://github.com/schollz/progressbar/pull/175](https://github.com/schollz/progressbar/pull/175)
-   fix Finish() should update state.currentBytes by [@&#8203;black-night-heron](https://github.com/black-night-heron) in [https://github.com/schollz/progressbar/pull/182](https://github.com/schollz/progressbar/pull/182)
-   fix race condition when changing max by [@&#8203;mxey](https://github.com/mxey) in [https://github.com/schollz/progressbar/pull/183](https://github.com/schollz/progressbar/pull/183)
-   fix: make elapsedTime option work in non-spinner mode by [@&#8203;wjf3121](https://github.com/wjf3121) in [https://github.com/schollz/progressbar/pull/184](https://github.com/schollz/progressbar/pull/184)

#### New Contributors

-   [@&#8203;ttmars](https://github.com/ttmars) made their first contribution in [https://github.com/schollz/progressbar/pull/175](https://github.com/schollz/progressbar/pull/175)
-   [@&#8203;black-night-heron](https://github.com/black-night-heron) made their first contribution in [https://github.com/schollz/progressbar/pull/182](https://github.com/schollz/progressbar/pull/182)
-   [@&#8203;mxey](https://github.com/mxey) made their first contribution in [https://github.com/schollz/progressbar/pull/183](https://github.com/schollz/progressbar/pull/183)
-   [@&#8203;wjf3121](https://github.com/wjf3121) made their first contribution in [https://github.com/schollz/progressbar/pull/184](https://github.com/schollz/progressbar/pull/184)

**Full Changelog**: schollz/progressbar@v3.14.2...v3.14.3

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on the first day of the month" (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
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