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

Print logs on top and bar at bottom #42

Open
fenollp opened this issue Jun 4, 2019 · 0 comments
Open

Print logs on top and bar at bottom #42

fenollp opened this issue Jun 4, 2019 · 0 comments

Comments

@fenollp
Copy link

fenollp commented Jun 4, 2019

In trying to reproduce the apt progress bar I adapted https://github.com/gosuri/uiprogress/blob/ec0f254bbca2b17ed68f18af8773a0527b522f01/example/simple/simple.go so that some lines are printed:

package main

import (
        "time"
        "fmt"

        "github.com/gosuri/uiprogress"
)

func main() {
        uiprogress.Start()            // start rendering
        bar := uiprogress.AddBar(100) // Add a new bar

        // optionally, append and prepend completion and elapsed time
        bar.AppendCompleted()
        bar.PrependElapsed()

        i := 0
        for bar.Incr() {
                time.Sleep(time.Millisecond * 20)
                i++
                if i % 10 == 0 {
                        fmt.Println("Well hello there")
                }
        }
}

I'd like for the lines to print above the progress bar, which would stay at the bottom. However I'm only getting duplicated progress and only one line printed (also not at the right place but I'm sure that's another issue):

   0s [=====>--------------------------------------------------------------]  10%
   0s [============>-------------------------------------------------------]  20%
   0s [===================>------------------------------------------------]  30%
   0s [==========================>-----------------------------------------]  40%
   0s [=================================>----------------------------------]  50%
   1s [========================================>---------------------------]  60%
   1s [===============================================>--------------------]  70%
   1s [======================================================>-------------]  80%
   1s [=============================================================>------]  90%
   1s [====================================================================] 100%
Well hello there
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

No branches or pull requests

1 participant