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

Feature scrolling detail #194

Merged
merged 6 commits into from
Sep 15, 2024
Merged

Conversation

chengxilo
Copy link
Contributor

@chengxilo chengxilo commented Aug 28, 2024

This pr is created to resolve #176.

You can using this new feature like this:

package main

import (
    "fmt"
    "github.com/schollz/progressbar/v3"
    "time"
)
func main(){
    bar := progressbar.NewOptions(100,progressbar.OptionSetMaxDetailRow(10))
    for i:=1;i<=100;i++{
        bar.AddDetail(fmt.Sprint("processing... ",i))
        if i%10==0{
            bar.Add(10)
        }
        time.Sleep(100*time.Millisecond)
    }
}

output would be:
image
in the end:
image

I use ANSI to solve this problem,which makes it easy for me to control the cursor of terminal. I avoid make the progressbar and detail a whole string to update the detail though it may cause difficulties. According to my own experience, the detail of progress has the update frequency which is much higher then progress bar. So it is better to make the detail update independently.

It works well when the maxDetailRow was set to a value smaller than the height of terminal. I am not sure whether it is needed to provide some function for users to get the max maxDetailRow they can set according to their operate system and the terminal they use.If it is needed, I will be glad to do further development for it.

English is not my mother language, so my writing might be weried. I can explain for anything of this pr if you ask me. Thank you for your patient and dedication.🫶

@schollz schollz merged commit 4c1391b into schollz:main Sep 15, 2024
1 check passed
@schollz
Copy link
Owner

schollz commented Sep 15, 2024

Thanks!

renovate bot referenced this pull request in nobl9/sloctl Sep 15, 2024
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[github.com/schollz/progressbar/v3](https://redirect.github.com/schollz/progressbar)
| `v3.14.6` -> `v3.15.0` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fschollz%2fprogressbar%2fv3/v3.15.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fschollz%2fprogressbar%2fv3/v3.15.0?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.6/v3.15.0?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.6/v3.15.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

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

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

[Compare
Source](https://redirect.github.com/schollz/progressbar/compare/v3.14.6...v3.15.0)

#### What's Changed

- new: feature scrolling detail by
[@&#8203;luo-cheng-xi](https://redirect.github.com/luo-cheng-xi) in
[https://github.com/schollz/progressbar/pull/194](https://redirect.github.com/schollz/progressbar/pull/194)
- fix: Acquire lock when printing text to fix race condition by
[@&#8203;gabe565](https://redirect.github.com/gabe565) in
[https://github.com/schollz/progressbar/pull/198](https://redirect.github.com/schollz/progressbar/pull/198)
- fix: change some attribute about time to time.Time{} by
[@&#8203;luo-cheng-xi](https://redirect.github.com/luo-cheng-xi) in
[https://github.com/schollz/progressbar/pull/196](https://redirect.github.com/schollz/progressbar/pull/196)
- fix:fixed the bug that changMax isn't working. by
[@&#8203;luo-cheng-xi](https://redirect.github.com/luo-cheng-xi) in
[https://github.com/schollz/progressbar/pull/193](https://redirect.github.com/schollz/progressbar/pull/193)

#### New Contributors

- [@&#8203;luo-cheng-xi](https://redirect.github.com/luo-cheng-xi) made
their first contribution in
[https://github.com/schollz/progressbar/pull/194](https://redirect.github.com/schollz/progressbar/pull/194)

**Full Changelog**:
schollz/progressbar@v3.14.6...v3.15.0

</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 was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/nobl9/sloctl).

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

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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.

Output os.exec stdout while the progress bar is pinned?
2 participants