{"id":22343330,"url":"https://github.com/goblinfactory/progress-bar","last_synced_at":"2025-07-30T01:33:02.335Z","repository":{"id":55630901,"uuid":"50785234","full_name":"goblinfactory/progress-bar","owner":"goblinfactory","description":"Multiplatform netstandard 2.0 C# console progress bar, with support for single or multithreaded progress updates.","archived":false,"fork":false,"pushed_at":"2021-09-02T22:05:54.000Z","size":10333,"stargazers_count":63,"open_issues_count":1,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-20T18:19:28.772Z","etag":null,"topics":["console","csharp","dotnet","dotnetcore","konsole","netstandard20","progress","progressbar"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/goblinfactory.png","metadata":{"files":{"readme":"README.md","changelog":"change-log.md","contributing":null,"funding":"FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["goblinfactory"]}},"created_at":"2016-01-31T17:10:12.000Z","updated_at":"2024-04-16T13:06:55.000Z","dependencies_parsed_at":"2022-08-15T05:00:20.493Z","dependency_job_id":null,"html_url":"https://github.com/goblinfactory/progress-bar","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/goblinfactory/progress-bar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goblinfactory%2Fprogress-bar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goblinfactory%2Fprogress-bar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goblinfactory%2Fprogress-bar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goblinfactory%2Fprogress-bar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/goblinfactory","download_url":"https://codeload.github.com/goblinfactory/progress-bar/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goblinfactory%2Fprogress-bar/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267209969,"owners_count":24053475,"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-07-26T02:00:08.937Z","response_time":62,"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":["console","csharp","dotnet","dotnetcore","konsole","netstandard20","progress","progressbar"],"created_at":"2024-12-04T08:15:49.027Z","updated_at":"2025-07-30T01:33:00.021Z","avatar_url":"https://github.com/goblinfactory.png","language":"C#","readme":"# (Goblinfactory.Konsole) progress-bar\r\n\r\n- C# (dotnet standard) console progress bar with support for single or multithreaded progress updates.\r\n\r\n### `Install-Package Goblinfactory.ProgressBar`\r\n\r\nScreenshot of progressbar demo using the double line progressbar, `ProgressBarTwoLine`.\r\n\r\n![InstallProgressBar](progressbar.gif)\r\n\r\n## OSX Notes and limitations\r\n\r\n- Tested on OSX, and currently only works if there is no screen scrolling.\r\n    - i.e. if you create progressbars and the screen scrolls when creating the progressbar, then the progressbars will not work correctly at present.\r\n\r\n## ProgressBar Usage\r\n\r\n```csharp\r\n\r\n    using Goblinfactory.ProgressBar;\r\n\r\n           . . .\r\n\r\n            var pb = new ProgressBar(50);\r\n            pb.Refresh(0, \"connecting to server to download 50 files sychronously.\");\r\n            Console.ReadLine();\r\n\r\n            pb.Refresh(25, \"downloading file number 25\");\r\n            Console.ReadLine();\r\n            pb.Refresh(50, \"finished.\");\r\n```\r\n\r\nproduces the following output\r\n\r\n```text\r\nItem 0     of 50   . (0  %)\r\nconnecting to server to download 50 files sychronously.\r\n```\r\n\r\n(press enter)\r\n\r\n```text\r\nItem 25    of 50   . (50%) ######################################\r\ndownloading file number 25\r\n```\r\n\r\n(press enter again)\r\n\r\n```text\r\nItem 50    of 50   . (100%) ############################################################################\r\nfinished.\r\n```\r\n\r\n## example of showing status update for parallel tasks\r\n\r\nThis example creates 10 seperate console progress bars, each being updated on a seperate thread. (This code generates the output visible in the animated gif.)\r\n\r\n```csharp\r\n\r\n            // demo; take the first 10 directories that have files from c:\\windows, and then pretends to process (list) them.\r\n            // processing of each directory happens on a different thread, to simulate multiple background tasks,\r\n            // e.g. file downloading.\r\n            // ==============================================================================================================\r\n            var dirs = Directory.GetDirectories(@\"c:\\windows\").Where(d=\u003e Directory.GetFiles(d).Count()\u003e0).Take(10);\r\n\r\n            var tasks = new List\u003cTask\u003e();\r\n            var bars = new List\u003cProgressBar\u003e();\r\n            foreach (var d in dirs)\r\n            {\r\n                var dir = new DirectoryInfo(d);\r\n                var files = dir.GetFiles().Take(100).Select(f=\u003ef.FullName).ToArray();\r\n                if (files.Count()==0) continue;\r\n                var bar = new ProgressBar(files.Count());\r\n                bars.Add(bar);\r\n                bar.Refresh(0, d);\r\n                tasks.Add(new Task(() =\u003e ProcessFiles(d, files, bar)));\r\n            }\r\n            Console.WriteLine(\"ready press enter.\");\r\n            Console.ReadLine();\r\n\r\n            foreach (var t in tasks) t.Start();\r\n            Task.WaitAll(tasks.ToArray());\r\n            Console.WriteLine(\"done.\");\r\n            Console.ReadLine();\r\n\r\n        }\r\n\r\n        public static void ProcessFiles(string directory, string[] files, ProgressBar bar)\r\n        {\r\n            var cnt = files.Count();\r\n            foreach (var file in files)\r\n            {\r\n                bar.Next(new FileInfo(file).Name);\r\n                Thread.Sleep(150);\r\n            }\r\n        }\r\n\r\n\r\n```\r\n\r\n## Still Todo\r\n\r\n- support screen scrolling.\r\n- finish documentation for ProgressBarSlim and ProgressBar.\r\n- Include tests\r\n- more manual testing\r\n- Some cleanup work to be done on resetting the cursor position when lots of threads updating progressbars\r\n- I think we need to move all the lock objects to a shared static ConsoleLocker class, as the current locking can bleed in some very high (lots of threads using both ProgressBar, ProgressBarSlim as well as ThreadSafeWriter.)\r\n\r\n## Mac Screenshots\r\n\r\nMulti threaded test using the default 1 line slim `ProgressBar` on mac ternimal.\r\n\r\nScreenshot below is the output from the [QuickTest sample project] (QuickTest/Program.cs).\r\n\r\n![multi-threaded test in mac terminal](progressbar-in-mac-terminal.png)\r\n\r\n## Useful links for future work\r\n\r\nhttps://docs.microsoft.com/en-us/windows/console/console-screen-buffersdoub","funding_links":["https://github.com/sponsors/goblinfactory"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoblinfactory%2Fprogress-bar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoblinfactory%2Fprogress-bar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoblinfactory%2Fprogress-bar/lists"}