{"id":24206381,"url":"https://github.com/open-tech-foundation/cli-pbar","last_synced_at":"2025-07-19T06:32:27.437Z","repository":{"id":47766712,"uuid":"191948953","full_name":"Open-Tech-Foundation/cli-pbar","owner":"Open-Tech-Foundation","description":"The Customizable CLI Progress Bars.","archived":false,"fork":false,"pushed_at":"2024-09-23T23:22:44.000Z","size":6204,"stargazers_count":12,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-29T14:15:51.219Z","etag":null,"topics":["bar","cli","color","colors","console","multiple","progress","progress-bar","terminal"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/Open-Tech-Foundation.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2019-06-14T13:35:31.000Z","updated_at":"2025-03-11T08:43:30.000Z","dependencies_parsed_at":"2024-06-21T20:20:43.306Z","dependency_job_id":"6d248019-7971-4d24-87a2-a968b669fe46","html_url":"https://github.com/Open-Tech-Foundation/cli-pbar","commit_stats":null,"previous_names":["open-tech-foundation/cli-pbar","open-tech-world/cli-progress-bar","open-tech-foundation/cli-progress-bar"],"tags_count":29,"template":false,"template_full_name":null,"purl":"pkg:github/Open-Tech-Foundation/cli-pbar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Open-Tech-Foundation%2Fcli-pbar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Open-Tech-Foundation%2Fcli-pbar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Open-Tech-Foundation%2Fcli-pbar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Open-Tech-Foundation%2Fcli-pbar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Open-Tech-Foundation","download_url":"https://codeload.github.com/Open-Tech-Foundation/cli-pbar/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Open-Tech-Foundation%2Fcli-pbar/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265898273,"owners_count":23845763,"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":["bar","cli","color","colors","console","multiple","progress","progress-bar","terminal"],"created_at":"2025-01-14T00:20:22.183Z","updated_at":"2025-07-19T06:32:27.415Z","avatar_url":"https://github.com/Open-Tech-Foundation.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg align=\"left\" src=\"https://open-tech-foundation.pages.dev/img/Logo.svg\" width=\"50\" height=\"50\"\u003e\n\n\u0026nbsp;[OPEN TECH FOUNDATION](https://open-tech-foundation.pages.dev/)\n\n\u003cdiv align=\"center\"\u003e\n\n# @opentf/cli-pbar\n\n[![Build](https://github.com/open-tech-foundation/cli-progress-bar/actions/workflows/build.yml/badge.svg)](https://github.com/open-tech-foundation/cli-progress-bar/actions/workflows/build.yml)\n\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n![Demo](./assets/demo-min.gif)\n\n\u003c/div\u003e\n\n\u003e The Customizable CLI Progress Bars.\n\n\u003cdiv align=\"center\"\u003e\n\n**Try it online at [https://node-repl.pages.dev](https://node-repl.pages.dev/)**\n\n\u003c/div\u003e\n\n---\n\n🚀 [@opentf/std](https://js-std.pages.dev/) - An Extensive JavaScript Standard Library. Please review and give feedback.\n\nPlease read our important articles:\n\n- [Introducing Our New JavaScript Standard Library](https://ganapathy.hashnode.dev/introducing-our-new-javascript-standard-library)\n\n- [You Don’t Need JavaScript Native Methods](https://ganapathy.hashnode.dev/you-dont-need-javascript-native-methods)\n\n---\n\n## Features\n\n- Single \u0026 Multi Progress Bars\n\n- Customizable (colors, size, etc)\n\n- TypeScript Support\n\n## Installation\n\nInstall it using your favourite package manager.\n\n```bash\nnpm install @opentf/cli-pbar\n```\n\n```bash\nyarn add @opentf/cli-pbar\n```\n\n```bash\npnpm add @opentf/cli-pbar\n```\n\n```bash\nbun add @opentf/cli-pbar\n```\n\n## Syntax\n\n```ts\nnew ProgressBar(options?: Options)\n```\n\n## Usage\n\nSingle progress bar.\n\n```ts\nimport { ProgressBar } from '@opentf/cli-pbar';\n\nconst pBar = new ProgressBar();\npBar.start({ total: 100 });\npBar.update({ value: 50 });\npBar.update({ value: 100 });\npBar.stop();\n```\n\nMulti progress bar.\n\n```ts\nimport { ProgressBar } from '@opentf/cli-pbar';\n\nconst multiPBar = new ProgressBar({ size: 'MEDIUM' });\nmultiPBar.start();\nconst b1 = multiPBar.add({ total: 100 });\nconst b2 = multiPBar.add({ total: 100 });\nconst b3 = multiPBar.add({ total: 100 });\nb1.update({ value: 23 });\nb3.update({ value: 35 });\nb2.update({ value: 17 });\nmultiPBar.stop();\n```\n\n\u003e [!TIP]\n\u003e It is recommended to use the `MEDIUM` sized bars in multi progress bars to get better visuals.\n\n## Examples\n\nUsing `inc()` to increment the progress bar value, hide the `percent` \u0026 show the `count`.\n\n```js\nimport { sleep, aForEach } from '@opentf/std';\nimport { ProgressBar } from '@opentf/cli-pbar';\n\nconst arr = ['Apple', 'Mango', 'Orange', 'Grapes', 'Pear', 'Guava'];\n\nconst pBar = new ProgressBar({\n  color: 'pi',\n  bgColor: 'r',\n  showPercent: false,\n  showCount: true,\n  prefix: 'Processing Fruits',\n});\n\npBar.start({ total: arr.length });\n\nawait aForEach(arr, async (f) =\u003e {\n  pBar.inc({ suffix: f });\n  await sleep(500);\n});\n\npBar.stop();\n```\n\n![Count Demo](./assets/count-demo.png)\n\n---\n\nRendering a plain variant progress bar.\n\n```js\nimport { ProgressBar } from '@opentf/cli-pbar';\n\nconst pBar = new ProgressBar({\n  variant: 'PLAIN',\n  prefix: 'Downloading',\n});\n\npBar.start({ total: 3 });\npBar.inc();\npBar.stop();\n```\n\n![Plain Variant Demo](./assets/plain-demo.png)\n\n---\n\nIt does not render progress bars in non TTY terminals, like CI, etc.\n\n```js\nimport { sleep, aForEach } from '@opentf/std';\nimport { ProgressBar } from '@opentf/cli-pbar';\n\nconst arr = ['File 1', 'File 2', 'File 3'];\nconst pBar = new ProgressBar({\n  prefix: 'Downloading',\n  showPercent: false,\n  showCount: true,\n});\n\npBar.start({ total: arr.length });\n\nawait aForEach(arr, async (f) =\u003e {\n  pBar.inc({ suffix: f });\n  await sleep(500);\n});\n\npBar.stop();\n```\n\n![CI Demo](./assets/ci-demo.png)\n\n## API\n\n### options:\n\n| Name        | Type        | Default        | Description                                                                                                                                                                                                                                                                                                                                              |\n| ----------- | ----------- | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| stream      | WriteStream | process.stderr | The [TTY](https://nodejs.org/docs/latest-v20.x/api/tty.html#class-ttywritestream) writable stream to use.                                                                                                                                                                                                                                                |\n| width       | number      | 30             | The size of the progress bar.                                                                                                                                                                                                                                                                                                                            |\n| prefix      | string      | ''             | The string to be prefixed progress bar.                                                                                                                                                                                                                                                                                                                  |\n| suffix      | string      | ''             | The string to be suffixed progress bar.                                                                                                                                                                                                                                                                                                                  |\n| color       | string      | 'g'            | The color to render the completed progress bar.\u003cbr /\u003eThe default color is `green`.\u003cbr /\u003e It uses [@opentf/cli-styles](https://www.npmjs.com/package/@opentf/cli-styles) for colors.\u003cbr /\u003eYou can also use the `rgb` \u0026 `hex` color modes, please refer the [supported color keys here](https://github.com/open-tech-foundation/js-cli-styles#color-keys). |\n| bgColor     | string      | 'gr'           | The color to render the incomplete progress bar.\u003cbr /\u003eThe default color is `grey`.\u003cbr /\u003e It uses [@opentf/cli-styles](https://www.npmjs.com/package/@opentf/cli-styles) for colors.\u003cbr /\u003eYou can also use the `rgb` \u0026 `hex` color modes, please refer the [supported color keys here](https://github.com/open-tech-foundation/js-cli-styles#color-keys). |\n| size        | string      | 'DEFAULT'      | The size of the progress bar to render.\u003cbr /\u003eAvailable sizes:\u003cbr/\u003e'DEFAULT'\u003cbr/\u003e'MEDIUM'\u003cbr/\u003e'SMALL'                                                                                                                                                                                                                                                     |\n| autoClear   | boolean     | false          | If true, then it auto-clears the progress bar after the `stop` method is called.                                                                                                                                                                                                                                                                         |\n| showPercent | boolean     | true           | If false, then it hides the progress bar percent.                                                                                                                                                                                                                                                                                                        |\n| showCount   | boolean     | false          | If true, then it show the progress bar count.                                                                                                                                                                                                                                                                                                            |\n| variant     | string      | 'STANDARD'     | There are two variants available, `STANDARD` \u0026 `PLAIN`.                                                                                                                                                                                                                                                                                                  |\n\n### Instance methods:\n\n**start(obj?: Partial\u003cBar\\\u003e): void**\n\nAfter the method is called, the progress bar starts rendering.\n\n#### Bar:\n\n| Name        | Type    | Default   | Description                                                                                                                                                                                                                                                                                                                                              |\n| ----------- | ------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| total       | number  | NaN       | The total value for the progress bar.                                                                                                                                                                                                                                                                                                                    |\n| value       | number  | NaN       | The current value of the progress bar.                                                                                                                                                                                                                                                                                                                   |\n| prefix      | string  | ''        | The string to be prefixed progress bar.                                                                                                                                                                                                                                                                                                                  |\n| suffix      | string  | ''        | The string to be suffixed progress bar.                                                                                                                                                                                                                                                                                                                  |\n| color       | string  | 'g'       | The color to render the completed progress bar.\u003cbr /\u003eThe default color is `green`.\u003cbr /\u003e It uses [@opentf/cli-styles](https://www.npmjs.com/package/@opentf/cli-styles) for colors.\u003cbr /\u003eYou can also use the `rgb` \u0026 `hex` color modes, please refer the [supported color keys here](https://github.com/open-tech-foundation/js-cli-styles#color-keys). |\n| bgColor     | string  | 'gr'      | The color to render the incomplete progress bar.\u003cbr /\u003eThe default color is `grey`.\u003cbr /\u003e It uses [@opentf/cli-styles](https://www.npmjs.com/package/@opentf/cli-styles) for colors.\u003cbr /\u003eYou can also use the `rgb` \u0026 `hex` color modes, please refer the [supported color keys here](https://github.com/open-tech-foundation/js-cli-styles#color-keys). |\n| size        | string  | 'DEFAULT' | The size of the progress bar.\u003cbr /\u003eAvailable sizes:\u003cbr/\u003e'DEFAULT'\u003cbr/\u003e'MEDIUM'\u003cbr/\u003e'SMALL'                                                                                                                                                                                                                                                               |\n| progress    | boolean | true      | If `false`, it does not render a progress bar, making it useful to add an empty line or text without displaying a progress bar.                                                                                                                                                                                                                          |\n| showPercent | boolean | true      | If false, then it hides the progress bar percent.                                                                                                                                                                                                                                                                                                        |\n| showCount   | boolean | false     | If true, then it show the progress bar count.                                                                                                                                                                                                                                                                                                            |\n\n### add(bar: Partial\u003cBar\\\u003e): { update: (bar: Partial\u003cBar\\\u003e) =\u003e void }\n\nIn `multi-progress`, it appends a progress bar to the container and returns an instance.\n\n### update(bar: Partial\u003cBar\\\u003e): void\n\nIt is used to update the current progress bar instance.\n\n### inc(bar: Partial\u003cBar\\\u003e): void\n\nIt increments the progress bar value and optionaly updates the other bar props.\n\n### stop(msg?: string): void\n\nStops the current progress bar instance with the current state and optionally clears the progress bar when `autoClear` is true.\n\nYou can also pass `msg` text to be displayed after the instance stops.\n\n## Supported Color Keys\n\n| Key | Description                |\n| --- | -------------------------- |\n| r   | Red - rgb(255,65,54)       |\n| g   | Green - rgb(46,204,64)     |\n| b   | Blue - rgb(0,116,217)      |\n| o   | Orange - rgb(255,133,27)   |\n| y   | Yellow - rgb(255,220,0)    |\n| w   | White - rgb(255,255,255)   |\n| m   | Magenta - rgb(255,105,193) |\n| c   | Cyan - rgb(154, 236, 254)  |\n| n   | Navy - rgb(0,31,63)        |\n| a   | Aqua - rgb(127,219,255)    |\n| t   | Teal - rgb(57,204,204)     |\n| p   | Purple - rgb(177,13,201)   |\n| f   | Fuchsia - rgb(240,18,190)  |\n| s   | Silver - rgb(221,221,221)  |\n| ma  | Maroon - rgb(133,20,75)    |\n| ol  | Olive - rgb(61,153,112)    |\n| li  | Lime - rgb(1,255,112)      |\n| bl  | Black - rgb(17,17,17)      |\n| gr  | Grey - rgb(170,170,170)    |\n| pi  | Pink - rgb(255, 191, 203)  |\n\n## Related\n\n- [@opentf/std](https://js-std.pages.dev/) - An Extensive JavaScript Standard Library.\n\n- [@opentf/cli-styles](https://github.com/Open-Tech-Foundation/js-cli-styles) - Style your CLI text using ANSI escape sequences.\n\n## License\n\nCopyright (c) 2021, [Thanga Ganapathy](https://thanga-ganapathy.github.io) ([MIT License](./LICENSE)).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopen-tech-foundation%2Fcli-pbar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopen-tech-foundation%2Fcli-pbar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopen-tech-foundation%2Fcli-pbar/lists"}