{"id":20510224,"url":"https://github.com/bmc-labs/progress_bar","last_synced_at":"2025-10-03T14:20:39.834Z","repository":{"id":198447457,"uuid":"197937054","full_name":"bmc-labs/progress_bar","owner":"bmc-labs","description":"Just a simple command line progress bar for C++.","archived":false,"fork":false,"pushed_at":"2020-05-20T14:14:45.000Z","size":460,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-05T22:31:32.043Z","etag":null,"topics":["command-line","cpp","header-only"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bmc-labs.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-20T13:54:29.000Z","updated_at":"2023-11-07T12:52:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"6ad565cf-8b89-465b-b8f3-8239c6921bc8","html_url":"https://github.com/bmc-labs/progress_bar","commit_stats":null,"previous_names":["bmc-labs/progress_bar"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bmc-labs/progress_bar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmc-labs%2Fprogress_bar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmc-labs%2Fprogress_bar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmc-labs%2Fprogress_bar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmc-labs%2Fprogress_bar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bmc-labs","download_url":"https://codeload.github.com/bmc-labs/progress_bar/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmc-labs%2Fprogress_bar/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278173726,"owners_count":25942363,"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","status":"online","status_checked_at":"2025-10-03T02:00:06.070Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["command-line","cpp","header-only"],"created_at":"2024-11-15T20:28:37.456Z","updated_at":"2025-10-03T14:20:39.771Z","avatar_url":"https://github.com/bmc-labs.png","language":"C++","readme":"\u003cp align=\"center\"\u003e\u003cimg src=\"./misc/progress_small.png\" width=\"15%\" /\u003e\u003c/p\u003e\n\n# `progress_bar` - a CLI progress bar\n\n[![pipeline status](https://gitlab.bmc-labs.com/libraries/progress_bar/badges/master/pipeline.svg)](https://gitlab.bmc-labs.com/libraries/progress_bar/commits/master)\n\n\u003ca href=\"https://asciinema.org/a/ZesQrQgJhN1HEu5nwbzww9GTf\" target=\"_blank\"\u003e\n  \u003cimg src=\"https://asciinema.org/a/ZesQrQgJhN1HEu5nwbzww9GTf.svg\" /\u003e\n\u003c/a\u003e\n\nI needed a command line progress bar and none of the options I found on GitHub\nor via Google were much to my liking, what with their camel cased names and\nlack of `operator\u003c\u003c` overload and such. Now this is certainly not the best ever\nimplementation of anything, I just hacked this together real quick. It\nsupposedly works on Windows, but I haven't tested that.\n\n\n## Using it\nIt's header only. It has no dependencies other than the STL and it's Apache v2\nlicensed.\n\nSo basically you just go\n```cpp\n#include \u003cchrono\u003e\n#include \u003ciostream\u003e\n#include \u003cnumeric\u003e\n#include \u003cthread\u003e\n#include \u003cvector\u003e\n\n#include \"progress_bar.h\"\n\n\nusing namespace std::chrono_literals;\n\n\nint main() {\n  bmc::progress_bar pb{\n    13,    // min, also initial value\n    156,   // max\n    80,    // width in percent of screen (including percentage and time)\n    true,  // auto increment when outputting\n    true   // show time at the end\n  };\n\n  // generate some data\n  std::vector\u003cint\u003e vec(pb.size());\n  std::iota(std::begin(vec), std::end(vec), 42);\n\n  for (auto \u0026 e : vec) {\n    e *= 2;\n    std::this_thread::sleep_for(50ms);\n    std::cout \u003c\u003c pb;\n  }\n\n  std::cout \u003c\u003c pb;  // if progress bar is already full, no increment happens\n\n  return 0;\n}\n```\n\nand you get\n```shell\n[-----\u003e                             ]  10% -  0:42.312 elapsed\n```\n\nOf course there are a bunch more things you can do. If you don't like it to\nauto increment when using `operator\u003c\u003c`, just give it a `false` there (4th ctor\nargument). You might then want to use `++` or `--` in exactly the way you'd\nexpect, or `step(int steps)`, or `set(int pos)`. Essentially, the following\nworks:\n```cpp\nbmc::progress_bar pb{-13, 156, 80, false, true};\n\n++pb;\npb++;\n--pb;\npb--;\n\npb.step(5);   // move 5 steps forward\npb.set(137);  // go to progress 137\n```\n\nIf you try to move outside `min` and `max`, it simply doesn't do that. If you\ntry to give it a `min` that is bigger than `max`, it throws. If you try to push\n`width` (percentage of terminal width) to 0, it throws.\n\n\n## More\nThat's it. The example above sits in `src/main.cc` and actually does run. Other\nthan that - just clone this repo and/or throw the header file in your project.\n\nYou're good to go.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbmc-labs%2Fprogress_bar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbmc-labs%2Fprogress_bar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbmc-labs%2Fprogress_bar/lists"}