{"id":16937917,"url":"https://github.com/nabijaczleweli/pb-cpp","last_synced_at":"2025-06-21T20:07:47.272Z","repository":{"id":66195244,"uuid":"115011775","full_name":"nabijaczleweli/pb-cpp","owner":"nabijaczleweli","description":" Console progress bar for C++","archived":false,"fork":false,"pushed_at":"2018-06-30T00:03:19.000Z","size":8730,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-11T19:14:08.167Z","etag":null,"topics":["cpp","cpp-library","cpp14","port","progress-bar"],"latest_commit_sha":null,"homepage":null,"language":"C++","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/nabijaczleweli.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":"2017-12-21T14:01:25.000Z","updated_at":"2024-12-27T08:25:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"f8688e42-130b-4f10-9d35-f4637b1684f1","html_url":"https://github.com/nabijaczleweli/pb-cpp","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/nabijaczleweli/pb-cpp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nabijaczleweli%2Fpb-cpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nabijaczleweli%2Fpb-cpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nabijaczleweli%2Fpb-cpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nabijaczleweli%2Fpb-cpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nabijaczleweli","download_url":"https://codeload.github.com/nabijaczleweli/pb-cpp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nabijaczleweli%2Fpb-cpp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261186776,"owners_count":23121944,"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":["cpp","cpp-library","cpp14","port","progress-bar"],"created_at":"2024-10-13T21:00:27.251Z","updated_at":"2025-06-21T20:07:42.257Z","avatar_url":"https://github.com/nabijaczleweli.png","language":"C++","readme":"# Terminal progress bar for C++ [![TravisCI Build Status](https://travis-ci.org/nabijaczleweli/pb-cpp.svg?branch=master)](https://travis-ci.org/nabijaczleweli/pb-cpp) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/7c1ghw38fowefi3s/branch/master?svg=true)](https://ci.appveyor.com/project/nabijaczleweli/pb-cpp/branch/master) [![Licence](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE)\nConsole progress bar for C++ inspired by [pb](https://github.com/a8m/pb).\n\n[![Poster for demo video](demo/pb-cpp%20demo%20small.png)](https://raw.githubusercontent.com/nabijaczleweli/pb-cpp/master/demo/pb-cpp%20demo%20small.mp4)\n\n## Examples\n\n1. Simple example\n\n```cpp\n#include \u003cpb-cpp/progressbar.hpp\u003e\n#include \u003cthread\u003e\nusing namespace std::literals;\n\nint main() {\n\tconst auto count = 1000u;\n\tpb::progressbar bar(count);\n\tbar.format(\"\u003c#} \u003e\");\n\n\tfor(auto i = 0u; i \u003c count; ++i) {\n\t\t++bar;\n\t\tstd::this_thread::sleep_for(200ms);\n\t}\n\n\tbar.finish();\n}\n```\n\n2. `pb::multibar` example, see full example [here](examples/multi.cpp):\n```cpp\n#include \u003cpb-cpp/multibar.hpp\u003e\n#include \u003cthread\u003e\nusing namespace std::literals;\n\nint main() {\n\tconst auto count = 100u;\n\tpb::multibar mb;\n\tmb.println(\"Application header:\");\n\n\tconst auto bar_handler = [](auto bar, auto count) {\n\t\tfor(auto i = 0u; i \u003c count; ++i) {\n\t\t\t++bar;\n\t\t\tstd::this_thread::sleep_for(100ms);\n\t\t}\n\n\t\tbar.finish();\n\t};\n\n\tstd::thread(bar_handler, mb.create_bar(count), count).detach();\n\tmb.println(\"Add a separator between the two bars\");\n\tstd::thread(bar_handler, mb.create_bar(count * 2), count * 2).detach();\n\n\t// Start listening to all bars' changes.\n\t// This blocks until all bars finish.\n\t// To ignore that, run it in a different thread.\n\tmb.listen();\n}\n```\n\n3. Simple file copy\n\n```cpp\n#include \u003cpb-cpp/progressbar.hpp\u003e\n#include \u003cfstream\u003e\n\nint main() {\n\tstd::ifstream in_file(\"/usr/share/dict/words\", std::ios::binary);\n\tconst auto file_size = std::ifstream(\"/usr/share/dict/words\", std::ios::ate | std::ios::binary).tellg();\n\n\tstd::ofstream out_file(\"copy-words\", std::ios::binary);\n\n\tpb::progressbar bar(file_size);\n\tbar.unit = pb::unit_t::byte;\n\n\tchar buf[4096];\n\tdo {\n\t\tin_file.read(buf, sizeof buf);\n\t\tout_file.write(buf, in_file.gcount());\n\t\tbar += in_file.gcount();\n\t} while(in_file.gcount() == sizeof buf);\n\tbar.finish();\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnabijaczleweli%2Fpb-cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnabijaczleweli%2Fpb-cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnabijaczleweli%2Fpb-cpp/lists"}