{"id":16138678,"url":"https://github.com/astromechza/pbars","last_synced_at":"2025-03-18T16:30:58.664Z","repository":{"id":57551132,"uuid":"87646061","full_name":"astromechza/pbars","owner":"astromechza","description":"Need a progress bar in your Golang CLI? This might help you","archived":false,"fork":false,"pushed_at":"2018-09-04T22:20:21.000Z","size":17,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-09T03:41:24.260Z","etag":null,"topics":["cli","golang","progress-bar"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/astromechza.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-08T16:02:26.000Z","updated_at":"2021-07-15T01:29:44.000Z","dependencies_parsed_at":"2022-09-26T18:41:22.029Z","dependency_job_id":null,"html_url":"https://github.com/astromechza/pbars","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astromechza%2Fpbars","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astromechza%2Fpbars/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astromechza%2Fpbars/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astromechza%2Fpbars/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/astromechza","download_url":"https://codeload.github.com/astromechza/pbars/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243940088,"owners_count":20372045,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","golang","progress-bar"],"created_at":"2024-10-09T23:44:58.502Z","updated_at":"2025-03-18T16:30:58.412Z","avatar_url":"https://github.com/astromechza.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `pbars` `|██████████▏                 |`\n\n[![GoDoc](https://godoc.org/github.com/AstromechZA/pbars?status.svg)](https://godoc.org/github.com/AstromechZA/pbars)\n[![Build](https://travis-ci.org/AstromechZA/pbars.svg?branch=master)](https://travis-ci.org/AstromechZA/pbars/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT)\n\n```golang\n// setup the printer\npp := pbars.NewProgressPrinter(\"My Title\", 50, true)\n\n// go!\nfor i := 0; i \u003c 400; i++ {\n    pp.Update(int64(i+1), 400)\n    time.Sleep(16 * time.Millisecond)\n}\n\n// new line required afterwards :)\npp.Done()\n```\n\n## Example\n\nThere's an [example in the /example directory](example/main.go) which does the following:\n\n![progress gif](http://i.imgur.com/v0G2JuG.gif?raw=true)\n\n\\* *cursor flickering is just the high (16ms) update rate and the way the gif was rendered*\n\n## Features\n\n- UTF8 blocks vs pure ASCII (sometimes a terminal doesn't support utf8 chars)\n\n```golang\npbars.NewProgressPrinter(\"My Title\", 50, true)   // utf8 mode\npbars.NewProgressPrinter(\"My Title\", 50, false)   // ascii mode\n```\n\n- When writing to Non-TTY output streams like files or those that don't support the `\\r` character, you can set `ProgressPrinter{}.NonTTY = true`. This will disable the progress bar until the `Done` function is called upon which it will print the final progress bar, rate, and elapsed time as normal.\n\n- Uses the overall units per second and elapsed time once you call `Done`\n\n- Customisable unit formats\n\nBy default the progress bar rate is formatted as 'units' per second. But often you'll want a measure of bytes or bits. The `ProgressPrinter` struct allows you to set the `UnitFunc` to be whatever you want as long as it looks like `func(v float64) string`. An example is the `pbars.ByteFormatFunc` that will convert to `B`, `KB`, `MB` etc.\n\n- `Interruptf` method for printing messages while the progress bar continues (see the example)\n\n- `Clear` method for clearing and removing the progress bar once you no longer need it\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastromechza%2Fpbars","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fastromechza%2Fpbars","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastromechza%2Fpbars/lists"}