Create README.md

This commit is contained in:
nxshock 2021-07-30 08:56:34 +05:00 committed by GitHub
parent 7bcf98ba3e
commit 63cec26e1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

40
README.md Normal file
View file

@ -0,0 +1,40 @@
# processmessage
Go library for displaying progress messages.
## Usage example
```go
package main
import (
"fmt"
"os"
"time"
"github.com/nxshock/progressmessage"
)
func main() {
// Create new message
pm := progressmessage.New("Progress: %d%%...")
// Start message display
pm.Start()
// Let's do some job
for i := 0; i < 100; i++ {
// Simulate some work
time.Sleep(time.Second / 5)
// Update progress variables in same order as specified on creating the message
pm.Update(i + 1)
}
// Stop message display
pm.Stop()
// Cursor stays in progress message position so you can display result message manually
fmt.Fprintln(os.Stderr, "\rProcessing finished.")
}
```