{"id":29765542,"url":"https://github.com/metaory/mbar.sh","last_synced_at":"2026-05-13T20:34:55.402Z","repository":{"id":305509675,"uuid":"1022652796","full_name":"metaory/mbar.sh","owner":"metaory","description":"minimal declarative bash status bar","archived":false,"fork":false,"pushed_at":"2025-07-20T13:21:49.000Z","size":280,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-29T04:39:18.913Z","etag":null,"topics":["bash","bash-statusline"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/metaory.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}},"created_at":"2025-07-19T14:36:16.000Z","updated_at":"2025-07-23T15:10:22.000Z","dependencies_parsed_at":"2025-07-20T15:23:08.232Z","dependency_job_id":null,"html_url":"https://github.com/metaory/mbar.sh","commit_stats":null,"previous_names":["metaory/mbar.sh"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/metaory/mbar.sh","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metaory%2Fmbar.sh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metaory%2Fmbar.sh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metaory%2Fmbar.sh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metaory%2Fmbar.sh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/metaory","download_url":"https://codeload.github.com/metaory/mbar.sh/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metaory%2Fmbar.sh/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32999515,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"ssl_error","status_checked_at":"2026-05-13T13:14:51.610Z","response_time":115,"last_error":"SSL_read: 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":["bash","bash-statusline"],"created_at":"2025-07-27T00:02:11.596Z","updated_at":"2026-05-13T20:34:55.385Z","avatar_url":"https://github.com/metaory.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"assets/logo.png\" width=\"300\" /\u003e\n  \u003ch1\u003e\u003ccode\u003embar.sh\u003c/code\u003e\u003c/h1\u003e\n  \u003ch3\u003eMinimal bash status bar library\u003c/h3\u003e\n  \u003ch5\u003esimple and declarative\u003c/h5\u003e\n  \u003cbr\u003e\n\u003c/div\u003e\n\n---\n\n## Overview\n\nmbar is a lightweight, zero-dependency status bar library for bash scripts.\nIt provides a clean, declarative interface for creating interactive status displays with keyboard handlers.\n\n## Installation\n\nGet a copy of the `mbar.sh` in your prefered method:\n\n\n```bash\n# curl GitHub API\ncurl -o mbar.sh -L \\\n  -H \"Accept: application/vnd.github.raw+json\" \\\n  https://api.github.com/repos/metaory/mbar.sh/contents/lib/mbar.sh\n\n# curl raw\ncurl -o mbar.sh \\\n  https://raw.githubusercontent.com/metaory/mbar.sh/refs/heads/master/lib/mbar.sh\n\n# wget raw\nwget -O mbar.sh \\\n  https://raw.githubusercontent.com/metaory/mbar.sh/refs/heads/master/lib/mbar.sh\n\n# clone the repository\ngit clone https://github.com/metaory/mbar.sh.git\n```\n\n```bash\n# Source in your script\nsource mbar.sh\n```\n\n## Quick Start\n\nCopy the `mbar.sh` to your project\n\n```bash\n#!/usr/bin/env bash\nsource mbar.sh\n\n# Define keys\nmbar_add_key \"p\" \"pause\"\nmbar_add_key \"q\" \"quit\"\n\n# Auto mode handlers\nmbar_handler_p() {\n  paused=$((paused ? 0 : 1))\n}\n\nmbar_handler_q() {\n  exit 0\n}\n\n# Run status loop\nfor i in {1..10}; do\n  mbar_loop \"Processing item $i\" \"green\"\n  sleep 0.5\ndone\n```\n\n---\n\n## API\n\n### Core Functions\n\n| Function                   | Description                             | Example                             |\n| -------------------------- | --------------------------------------- | ----------------------------------- |\n| `mbar_loop(msg, color)`    | Main status loop with keyboard handling | `mbar_loop \"Processing...\" \"green\"` |\n| `mbar_show(msg, color)`    | Display status message                  | `mbar_show \"Ready\" \"cyan\"`          |\n| `mbar_add_key(key, desc)`  | Register key with description           | `mbar_add_key \"p\" \"pause\"`          |\n| `mbar_register(key, func)` | Register explicit handler               | `mbar_register \"s\" stop_func`       |\n\n### Colors\n\n- `green` - Success/ready\n- `yellow` - Warning/paused  \n- `red` - Error/stopped\n- `cyan` - Info\n- `magenta` - Highlight\n\n---\n\n## Usage Modes\n\n### 1. Auto Mode (Convention-based)\n\nFunctions named `mbar_handler_\u003ckey\u003e` are automatically discovered:\n\n```bash\n#!/usr/bin/env bash\nsource mbar.sh\n\nmbar_add_key \"p\" \"pause\"\nmbar_add_key \"s\" \"stop\"\n\nmbar_handler_p() {\n  paused=$((paused ? 0 : 1))\n}\n\nmbar_handler_s() {\n  exit 0\n}\n\nwhile true; do\n  mbar_loop \"System running\" \"green\"\n  sleep 1\ndone\n```\n\n**Example**: [`examples/basic.sh`](examples/basic.sh)\n\n### 2. Advanced Usage (Mixed Mode)\n\nCombine auto and manual handlers with practical features:\n\n```bash\n#!/usr/bin/env bash\nsource mbar.sh\n\nmbar_add_key \"p\" \"pause\"\nmbar_add_key \"s\" \"stop\"\nmbar_add_key \"l\" \"list\"\nmbar_add_key \"i\" \"info\"\n\n# Auto mode handlers\nmbar_handler_p() {\n  paused=$((paused ? 0 : 1))\n}\n\nmbar_handler_s() {\n  exit 0\n}\n\n# Manual mode handlers\nlist_files() {\n  echo \"Files: $(ls | wc -l)\"\n}\n\nshow_info() {\n  echo \"Processed: $processed/$total\"\n}\n\nmbar_register \"l\" list_files\nmbar_register \"i\" show_info\n\nfor i in {1..10}; do\n  mbar_loop \"Processing item $i\" \"cyan\"\n  sleep 0.3\ndone\n```\n\n**Example**: [`examples/advanced.sh`](examples/advanced.sh)\n\n---\n\n## Requirements\n\n- `Bash 4.0+` (for associative arrays)\n- No external dependencies\n\n\n\u003e [!NOTE]\n\u003e for macOS users\n\u003e\n\u003e The library uses `#!/usr/bin/env bash` to automatically find the correct bash version.\n\u003e If you're using the system bash, install the latest bash:\n\u003e\n\u003e `brew install bash`\n\n---\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetaory%2Fmbar.sh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmetaory%2Fmbar.sh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetaory%2Fmbar.sh/lists"}