{"id":28580165,"url":"https://github.com/elulcao/progress-bar","last_synced_at":"2026-02-18T05:11:39.807Z","repository":{"id":144345986,"uuid":"459233359","full_name":"elulcao/progress-bar","owner":"elulcao","description":"Progress bar in Go","archived":false,"fork":false,"pushed_at":"2026-02-15T21:22:11.000Z","size":3808,"stargazers_count":27,"open_issues_count":1,"forks_count":7,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-16T04:20:33.622Z","etag":null,"topics":["ansi","go","golang","progress-bar","progressbar","terminal"],"latest_commit_sha":null,"homepage":"","language":"Go","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/elulcao.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-02-14T16:16:18.000Z","updated_at":"2026-02-15T21:22:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"8aa1696b-18e1-44f5-9d04-d1e676dafcd2","html_url":"https://github.com/elulcao/progress-bar","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/elulcao/progress-bar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elulcao%2Fprogress-bar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elulcao%2Fprogress-bar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elulcao%2Fprogress-bar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elulcao%2Fprogress-bar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elulcao","download_url":"https://codeload.github.com/elulcao/progress-bar/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elulcao%2Fprogress-bar/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29569856,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-18T04:18:28.490Z","status":"ssl_error","status_checked_at":"2026-02-18T04:13:49.018Z","response_time":162,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["ansi","go","golang","progress-bar","progressbar","terminal"],"created_at":"2025-06-11T03:16:20.062Z","updated_at":"2026-02-18T05:11:34.799Z","avatar_url":"https://github.com/elulcao.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# progress-bar\n\n[![Go CI](https://github.com/elulcao/progress-bar/actions/workflows/go.yaml/badge.svg)](https://github.com/elulcao/progress-bar/blob/main/.github/workflows/go.yaml)\n[![CodeQl CI](https://github.com/elulcao/progress-bar/actions/workflows/codeql-analysis.yaml/badge.svg)](https://github.com/elulcao/progress-bar/blob/main/.github/workflows/codeql-analysis.yaml)\n\n---\n\n\u003cp\n    align=\"center\"\u003e\n    \u003cimg\n        src=\"./.assets/demo-01.gif\"\n        alt=\"Demo 01\"\n        width=\"600\"\n        height=\"400\"\n    /\u003e\n\u003c/p\u003e\n\n---\n\nAnother simple progress bar, but with a package installer flavor. The progress bar displays the\nprogress like the well known package manager. This version adapts well to the windows size, small\nor big window size the progress bar will adapt to the change; the progress bar will adapt to the\nwindow size automatically.\n\nLast line of the window is preserved to show the progress, the rest of the window is used to show\nthe program output that consumes the `progress-bar`.\n\nCharacters used by default are \"#\" and \".\" but can be changed by updating the struct:\n\n```go\ntype PBar struct {\n    //...\n    DoneStr    = \"#\"\n    OngoingStr = \".\"\n    //...\n}\n```\n\n## Usage\n\nThe `progress-bar.go` should be modified to your needs, currently implementation is limited to\nprinting numbers from 1 to 100. In a real world scenario, the `count` variable should be used to\nbe updated by another routine in your code.\n\n```go\n for count := 1; count \u003c= pBar.Total; count++ {\n    pBar.renderPBar(count)\n    time.Sleep(time.Second)    // sleep for 1 second\n    fmt.Println(count)         // Update here to your needs\n }\n```\n\nThe `main.go` file can be used to test the progress bar. It is not used in the real world, but it\ncan be used as a reference.\n\n```go\ngo run main.go\n```\n\n## Notes\n\nThe `progress-bar` has to handler, `syscall.SIGWINCH` and `syscall.SIGTERM`, the first one is used\nto detect the window size change and the second one is used to detect the program termination.\nThese handlers can be removed if not needed, your driver code should be able to handle the\ninterruptions.\n\n`progress-bar_test.go` is used to test the progress bar but the most basic usabillity since the test\nis executed without a `TTY`. Due to this, the re-size of the window is not validated for now. It's\nhighly recommended to verify the `progress_bar.go` via `go run main.go` to ensure the correct output.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felulcao%2Fprogress-bar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felulcao%2Fprogress-bar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felulcao%2Fprogress-bar/lists"}