diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..daf70d5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.DS_Store +/bin/ +/_gopath/ diff --git a/README.md b/README.md index 8bcfb1f..26a3508 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,13 @@ -# uiprogress [![GoDoc](https://godoc.org/github.com/gosuri/uiprogress?status.svg)](https://godoc.org/github.com/gosuri/uiprogress) [![Build Status](https://travis-ci.org/gosuri/uiprogress.svg?branch=master)](https://travis-ci.org/gosuri/uiprogress) +# uiprogress [![GoDoc](https://godoc.org/github.com/docker-slim/uiprogress?status.svg)](https://godoc.org/github.com/docker-slim/uiprogress) [![Build Status](https://travis-ci.org/docker-slim/uiprogress.svg?branch=master)](https://travis-ci.org/docker-slim/uiprogress) + +## Note + +Fixing the os.Exit problem in its dependency and a few other things... + +Enhancements: +* No default progress bar + +## Original Package Info A Go library to render progress bars in terminal applications. It provides a set of flexible features with a customizable API. @@ -6,14 +15,14 @@ A Go library to render progress bars in terminal applications. It provides a set Progress bars improve readability for terminal applications with long outputs by providing a concise feedback loop. -## Features +### Features * __Multiple Bars__: uiprogress can render multiple progress bars that can be tracked concurrently * __Dynamic Addition__: Add additional progress bars any time, even after the progress tracking has started * __Prepend and Append Functions__: Append or prepend completion percent and time elapsed to the progress bars * __Custom Decorator Functions__: Add custom functions around the bar along with helper functions -## Usage +### Usage To start listening for progress bars, call `uiprogress.Start()` and add a progress bar using `uiprogress.AddBar(total int)`. Update the progress using `bar.Incr()` or `bar.Set(n int)`. Full source code for the below example is available at [example/simple/simple.go](example/simple/simple.go) @@ -34,7 +43,7 @@ This will render the below in the terminal ![example](doc/example_simple.gif) -### Using Custom Decorators +#### Using Custom Decorators You can also add a custom decorator function in addition to default `bar.AppendCompleted()` and `bar.PrependElapsed()` decorators. The below example tracks the current step for an application deploy progress. Source code for the below example is available at [example/full/full.go](example/full/full.go) @@ -52,7 +61,7 @@ for bar.Incr() { } ``` -### Rendering Multiple bars +#### Rendering Multiple bars You can add multiple bars using `uiprogress.AddBar(n)`. The below example demonstrates updating multiple bars concurrently and adding a new bar later in the pipeline. Source for this example is available at [example/multi/multi.go](example/multi/multi.go) @@ -100,9 +109,9 @@ This will produce ![example](doc/example_multi.gif) -### `Incr` counter +#### `Incr` counter -[Bar.Incr()](https://godoc.org/github.com/gosuri/uiprogress#Bar.Incr) is an atomic counter and can be used as a general tracker, making it ideal for tracking progress of work fanned out to a lots of go routines. The source code for the below example is available at [example/incr/incr.go](example/incr/incr.go) +[Bar.Incr()](https://godoc.org/github.com/docker-slim/uiprogress#Bar.Incr) is an atomic counter and can be used as a general tracker, making it ideal for tracking progress of work fanned out to a lots of go routines. The source code for the below example is available at [example/incr/incr.go](example/incr/incr.go) ```go runtime.GOMAXPROCS(runtime.NumCPU()) // use all available cpu cores @@ -131,16 +140,16 @@ wg.Wait() uiprogress.Stop() ``` -## Installation +### Installation ```sh -$ go get -v github.com/gosuri/uiprogress +$ go get -v github.com/docker-slim/uiprogress ``` -## Todos +### Todos - [ ] Resize bars and decorators by auto detecting window's dimensions - [ ] Handle more progress bars than vertical screen allows -## License +### License -uiprogress is released under the MIT License. See [LICENSE](https://github.com/gosuri/uiprogress/blob/master/LICENSE). +uiprogress is released under the MIT License. See [LICENSE](https://github.com/docker-slim/uiprogress/blob/master/LICENSE). diff --git a/bar.go b/bar.go index 6c27be2..df2068c 100644 --- a/bar.go +++ b/bar.go @@ -7,7 +7,7 @@ import ( "sync" "time" - "github.com/gosuri/uiprogress/util/strutil" + "github.com/slimtoolkit/uiprogress/util/strutil" ) var ( diff --git a/example/bypass/bypass.go b/example/bypass/bypass.go index 347fe9f..d2cb90e 100644 --- a/example/bypass/bypass.go +++ b/example/bypass/bypass.go @@ -5,7 +5,7 @@ import ( "sync" "time" - "github.com/gosuri/uiprogress" + "github.com/slimtoolkit/uiprogress" ) func main() { diff --git a/example/full/full.go b/example/full/full.go index a7e5a8d..356ad12 100644 --- a/example/full/full.go +++ b/example/full/full.go @@ -6,8 +6,8 @@ import ( "sync" "time" - "github.com/gosuri/uiprogress" - "github.com/gosuri/uiprogress/util/strutil" + "github.com/slimtoolkit/uiprogress" + "github.com/slimtoolkit/uiprogress/util/strutil" ) var steps = []string{ diff --git a/example/incr/incr.go b/example/incr/incr.go index 2f81e0e..6ef8d5a 100644 --- a/example/incr/incr.go +++ b/example/incr/incr.go @@ -7,7 +7,7 @@ import ( "sync" "time" - "github.com/gosuri/uiprogress" + "github.com/slimtoolkit/uiprogress" ) func main() { diff --git a/example/multi/multi.go b/example/multi/multi.go index e54ae9e..52b7eba 100644 --- a/example/multi/multi.go +++ b/example/multi/multi.go @@ -4,7 +4,7 @@ import ( "sync" "time" - "github.com/gosuri/uiprogress" + "github.com/slimtoolkit/uiprogress" ) func main() { diff --git a/example/simple/simple.go b/example/simple/simple.go index d8d912b..bb54407 100644 --- a/example/simple/simple.go +++ b/example/simple/simple.go @@ -3,7 +3,7 @@ package main import ( "time" - "github.com/gosuri/uiprogress" + "github.com/slimtoolkit/uiprogress" ) func main() { diff --git a/example_test.go b/example_test.go index d365e07..515606a 100644 --- a/example_test.go +++ b/example_test.go @@ -7,7 +7,7 @@ import ( "sync" "time" - "github.com/gosuri/uiprogress" + "github.com/slimtoolkit/uiprogress" ) func Example() { diff --git a/progress.go b/progress.go index 1caacd1..b1311ec 100644 --- a/progress.go +++ b/progress.go @@ -7,7 +7,7 @@ import ( "sync" "time" - "github.com/gosuri/uilive" + "github.com/slimtoolkit/uilive" ) // Out is the default writer to render progress bars to @@ -16,8 +16,8 @@ var Out = os.Stdout // RefreshInterval in the default time duration to wait for refreshing the output var RefreshInterval = time.Millisecond * 10 -// defaultProgress is the default progress -var defaultProgress = New() +// defaultProgress is the default progress <- removing +//var defaultProgress = New() // Progress represents the container that renders progress bars type Progress struct { @@ -42,6 +42,10 @@ type Progress struct { // New returns a new progress bar with defaults func New() *Progress { lw := uilive.New() + if lw == nil { + return nil + } + lw.Out = Out return &Progress{ @@ -56,25 +60,29 @@ func New() *Progress { } } +//removing... // AddBar creates a new progress bar and adds it to the default progress container -func AddBar(total int) *Bar { - return defaultProgress.AddBar(total) -} +//func AddBar(total int) *Bar { +// return defaultProgress.AddBar(total) +//} +//removing... // Start starts the rendering the progress of progress bars using the DefaultProgress. It listens for updates using `bar.Set(n)` and new bars when added using `AddBar` -func Start() { - defaultProgress.Start() -} +//func Start() { +// defaultProgress.Start() +//} +//removing... // Stop stops listening -func Stop() { - defaultProgress.Stop() -} +//func Stop() { +// defaultProgress.Stop() +//} +//removing... // Listen listens for updates and renders the progress bars -func Listen() { - defaultProgress.Listen() -} +//func Listen() { +// defaultProgress.Listen() +//} func (p *Progress) SetOut(o io.Writer) { p.mtx.Lock() pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy