{"id":21435657,"url":"https://github.com/horta/almosthere","last_synced_at":"2025-07-14T14:32:26.252Z","repository":{"id":43961736,"uuid":"116156340","full_name":"horta/almosthere","owner":"horta","description":"Progress indicator library written in C.","archived":false,"fork":false,"pushed_at":"2024-11-08T14:03:05.000Z","size":455,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-08T09:44:20.399Z","etag":null,"topics":["c","progress","progress-bar"],"latest_commit_sha":null,"homepage":"","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/horta.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2018-01-03T16:07:51.000Z","updated_at":"2024-11-08T14:03:09.000Z","dependencies_parsed_at":"2024-11-07T12:29:39.391Z","dependency_job_id":"eae6b648-e3be-483b-abae-e07ce0f366de","html_url":"https://github.com/horta/almosthere","commit_stats":{"total_commits":313,"total_committers":3,"mean_commits":"104.33333333333333","dds":"0.38338658146964855","last_synced_commit":"f6839deb7faa57be5920fa6a6aacfb2115af45fb"},"previous_names":[],"tags_count":72,"template":false,"template_full_name":null,"purl":"pkg:github/horta/almosthere","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/horta%2Falmosthere","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/horta%2Falmosthere/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/horta%2Falmosthere/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/horta%2Falmosthere/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/horta","download_url":"https://codeload.github.com/horta/almosthere/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/horta%2Falmosthere/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265305746,"owners_count":23743894,"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":["c","progress","progress-bar"],"created_at":"2024-11-22T23:45:09.673Z","updated_at":"2025-07-14T14:32:25.939Z","avatar_url":"https://github.com/horta.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Almosthere\n\nProgress indicator C library.\n\nATHR is a simple yet powerful progress indicator library that works on Windows, Linux, and macOS. It is non-blocking as the progress update is done via a dedicated, lightweight thread, as to not impair the performance of the calling program.\n\n## Get started\n\nOn Linux, macOS, and Windows (Git bash terminal) open a terminal and install it via\n\n```bash\n/bin/bash -c \"$(curl -fsSL https://git.io/Jz7Oa)\" -s horta/almosthere\n```\n\nThe above commands will download the latest library version, compile it to create a dynamic library and copy the C header into the appropriate directory. (For a more manual approach, see the section [Manual installation](#manual-installation) in this document.)\n\nIt is now ready to be linked into in your C/C++ project. Suppose you have a file `example.c` that makes use of this library. Using `gcc` compiler, you can do\n\n```bash\ngcc example.c -lathr -o example\n```\n\nto produce a binary `example` linked against `athr` library.\n\n## Examples\n\n```c\n/* example1.c */\n\n#include \"athr.h\"\n\nint main() {\n    struct athr *at = athr_create(100);\n    int i;\n\n    for (i = 0; i \u003c 100; ++i) {\n        athr_sleep(50); /* some time-consuming task */\n        athr_eat(at, 1);\n    }\n\n    athr_finish(at);\n\n    return 0;\n}\n```\n\n![Example 1](.github/assets/example1.gif)\n\n```c\n/* example2.c */\n\n#include \"athr.h\"\n\nint main() {\n    struct athr *at = athr_create(100, \"My tasks\");\n    int i;\n\n    for (i = 0; i \u003c 100; ++i) {\n        athr_sleep(50); /* some time-consuming task */\n        athr_eat(at, 1);\n    }\n\n    athr_finish(at);\n\n    return 0;\n}\n```\n\n![Example 2](.github/assets/example2.gif)\n\n```c\n/* example3.c */\n\n#include \"athr.h\"\n\nint main() {\n    struct athr *at = athr_create(100, \"My tasks\", ATHR_PERC);\n    int i;\n\n    for (i = 0; i \u003c 100; ++i) {\n        athr_sleep(50); /* some time-consuming task */\n        athr_eat(at, 1);\n    }\n\n    athr_finish(at);\n\n    return 0;\n}\n```\n\n![Example 3](.github/assets/example3.gif)\n\n```c\n/* example4.c */\n\n#include \"athr.h\"\n\nint main() {\n    struct athr *at = athr_create(100, .opts = ATHR_PERC);\n    int i;\n\n    for (i = 0; i \u003c 100; ++i) {\n        athr_sleep(50); /* some time-consuming task */\n        athr_eat(at, 1);\n    }\n\n    athr_finish(at);\n\n    return 0;\n}\n```\n\n![Example 4](.github/assets/example4.gif)\n\n## Manual installation\n\nClone and enter into the repository folder\n\n```bash\ngit clone https://github.com/horta/almosthere\ncd almosthere\n```\n\nCreate a `build` folder to not clutter the project and proceed with cmake steps\n\n```bash\nmkdir build \u0026\u0026 cd build\ncmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON\nmake \u0026\u0026 make test \u0026\u0026 make install\n```\n\n## Interface\n\nIt consists in two functions\n\n```c\nvoid athr_eat(struct athr *at, uint64_t amount);\nvoid athr_finish(struct athr *at);\n```\n\na variadic macro\n\n```c\nathr_create(...)\n```\n\nand three enum options\n\n```c\nenum ATHR_OPTS { ATHR_BAR = 1, ATHR_ETA = 2, ATHR_PERC = 4 };\n```\n\nThe variadic macro is better explained by examples\n\n```c\n/* progress indicator with ATHR_BAR, ATHR_ETA, and ATHR_PERC widgets */\nstruct athr *at0 = athr_create(100);\n\n/* progress indicator with all the widgets plus a description */\nstruct athr *at1 = athr_create(100, \"Description\");\n\n/* progress indicator with ATHR_BAR widget plus a description */\nstruct athr *at2 = athr_create(100, \"Description\", ATHR_BAR);\n\n/* progress indicator with ATHR_BAR and ATHR_ETA widgets plus a description */\nstruct athr *at3 = athr_create(100, \"Description\", ATHR_BAR | ATHR_ETA);\n\n/* progress indicator with ATHR_PERC widget plus a description */\nstruct athr *at4 = athr_create(100, .opts=ATHR_PERC, .desc=\"Description\");\n\n/* progress indicator with ATHR_PERC widget only */\nstruct athr *at5 = athr_create(100, .opts=ATHR_PERC);\n```\n\nThe first parameter is mandatory and specify the total volume from which we will consume through `athr_eat` calls.\nA `athr_finish` call then ends the process.\n\n## Authors\n\n- [Danilo Horta](https://github.com/horta)\n\n## Acknowledgements\n\n- [bk. answer](https://stackoverflow.com/a/2926165) for providing the mechanism of defining default arguments in C.\n- [asciinema](https://asciinema.org/) for such amazing recording tool.\n- [asciicast2gif](https://github.com/asciinema/asciicast2gif) for the converter tool from asciinema cast to gif.\n\n## License\n\nThis project is licensed under the [MIT License](https://raw.githubusercontent.com/horta/almosthere/main/LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhorta%2Falmosthere","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhorta%2Falmosthere","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhorta%2Falmosthere/lists"}