{"id":13463078,"url":"https://github.com/paul/progress_bar","last_synced_at":"2025-03-25T06:31:30.692Z","repository":{"id":56264777,"uuid":"1580108","full_name":"paul/progress_bar","owner":"paul","description":"A Ruby terminal progress_bar","archived":false,"fork":false,"pushed_at":"2024-05-28T17:50:44.000Z","size":237,"stargazers_count":627,"open_issues_count":9,"forks_count":48,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-03-15T07:03:23.494Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"wtfpl","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paul.png","metadata":{"files":{"readme":"README.mkd","changelog":"Changelog.mkd","contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"paul","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2011-04-07T01:12:03.000Z","updated_at":"2025-03-11T08:25:49.000Z","dependencies_parsed_at":"2024-05-28T19:54:02.982Z","dependency_job_id":"8d3eba67-3d8f-4dab-9603-900c4ab1f07a","html_url":"https://github.com/paul/progress_bar","commit_stats":{"total_commits":98,"total_committers":16,"mean_commits":6.125,"dds":"0.26530612244897955","last_synced_commit":"1f7880cb175fea68ff9febf5ea5c14f354340598"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paul%2Fprogress_bar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paul%2Fprogress_bar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paul%2Fprogress_bar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paul%2Fprogress_bar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paul","download_url":"https://codeload.github.com/paul/progress_bar/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243875377,"owners_count":20362000,"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":[],"created_at":"2024-07-31T13:00:45.622Z","updated_at":"2025-03-25T06:31:30.391Z","avatar_url":"https://github.com/paul.png","language":"Ruby","readme":"# ProgressBar\n\n[![Build Status](https://github.com/paul/progress_bar/workflows/Test/badge.svg)](https://github.com/paul/progress_bar/actions)[![Gem Version](https://badge.fury.io/rb/progress_bar.svg)](http://badge.fury.io/rb/progress_bar)\n\n*ProgressBar* is a simple Ruby library for displaying progress of\nlong-running tasks on the console. It is intended to be as simple to use\nas possible.\n\n**NOTE:** This project isn't dead! It's just feature complete, and I don't want\nto keep adding things to it. If you find bugs, please open an Issue, or even\nbetter, a Pull Request, and I'll take a look. We at ProgressBar know you have\nlots of progress bar alternatives, and we thank you for using ProgressBar!\n\n\n# Installation\n\n    gem install progress_bar\n\n# Examples\n\n## The Easy Way\n\n```ruby\nrequire 'progress_bar'\n\nbar = ProgressBar.new\n\n100.times do\n  sleep 0.1\n  bar.increment!\nend\n```\n\nProduces output like:\n\n    [#######################################                           ] [ 59.00%] [00:06]\n\n*Note: It may not be exactly like this. I might have changed the default\nmeters between now and when I wrote this readme, and forgotten to update\nit.*\n\n## Setting the Max\n\nUsually, the defaults should be fine, the only thing you'll need to\ntweak is the max.\n\n```ruby\nbar = ProgressBar.new(1000)\n```\n\n## Larger Steps\n\nIf you want to process several things, and update less often, you can\npass a number to `#increment!`\n\n```ruby\n    bar.increment! 42\n```\n\n## Printing additional output\n\nSometimes you want to print some additional messages in the output, but since the ProgressBar uses terminal control characters to replace the text on the same line on every update, the output looks funny:\n\n    [#######################################                           ] [ 59.00%] [00:06]\n    Hello!\n    [#########################################                         ] [ 60.00%] [00:05]\n\nTo prevent this, you can use `ProgressBar#puts` so ProgressBar knows you want to print something, and it'll clear the bar before printing, then resume printing on the next line:\n\n```ruby\n100.times do |i|\n  sleep 0.1\n  bar.puts \"Halfway there!\" if i == 50\n  bar.increment!\nend\n```\n\nProduces output like:\n\n    Halfway there!\n    [##################################] [100/100] [100%] [00:10] [00:00] [  9.98/s]\n\nTry it out in `examples/printing_messages.rb` to see how it looks.\n\n## Picking the meters\n\nBy default, ProgressBar will use all available meters (this will\nprobably change). To select which meters you want, and in which order,\npass them to the constructor:\n\n```ruby\nbar = ProgressBar.new(100, :bar, :rate, :eta)\n```\n\n\n### Available Meters\n\n * `:bar` -- The bar itself, fills empty space with \"#\"s. Ex: `[###\n   ]`.\n * `:counter` -- Number of items complete, over the max. Ex: `[ 20/100]`\n * `:percentage` -- Percentage of items in the maximum. Ex: `[ 42%]`\n * `:elapsed` -- Time elapsed (since the ProgressBar was initialized.\n   Ex: `[00:42]`\n * `:eta` -- Estimated Time remaining. Given the rate that items are\n   completed, a guess at how long the rest will take. Ex: `[01:30]`\n * `:rate` -- The rate at which items are being completed. Ex: `[\n   42.42/s]`\n\nRun the tests to see examples of all the formats, with different values\nand maximums.\n```\ngem install --development progress_bar\nrspec spec/*_spec.rb\n```\n\n## Using ProgressBar on Enumerable-alikes.\n\nIf you do a lot of progresses, you can shorten your way with this:\n\n```ruby\nclass Array\n  include ProgressBar::WithProgress\nend\n\n[1,2,3].each_with_progress{do_something}\n\n# or any other Enumerable's methods:\n\n(1..1000).to_a.with_progress.select{|i| (i % 2).zero?}\n```\n\nYou can include `ProgressBar::WithProgress` in any class, having methods\n`#count` and `#each`, like some DB datasets and so on.\n\nIf you are using progress_bar regularly on plain arrays, you may want to\ndo:\n\n```ruby\nrequire 'progress_bar/core_ext/enumerable_with_progress'\n\n# it adds each_with_progress/with_progress to Array/Hash/Range\n\n(1..400).with_progress.select{|i| (i % 2).zero?}\n```\n\nIf you want to display only specific meters you can do it like so:\n\n```ruby\n(1..400).with_progress(:bar, :elapsed).select{|i| (i % 2).zero?}\n```\n","funding_links":["https://github.com/sponsors/paul"],"categories":["Developer Tools"],"sub_categories":["CLI Progress Bars"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaul%2Fprogress_bar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaul%2Fprogress_bar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaul%2Fprogress_bar/lists"}