{"id":19529965,"url":"https://github.com/loopmode/bash-print","last_synced_at":"2026-05-28T16:31:12.519Z","repository":{"id":140399617,"uuid":"158514203","full_name":"loopmode/bash-print","owner":"loopmode","description":"Bash helper for displaying messages in colored blocks","archived":false,"fork":false,"pushed_at":"2018-11-21T09:06:14.000Z","size":616,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-26T02:43:18.364Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/loopmode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2018-11-21T08:19:23.000Z","updated_at":"2018-11-21T09:06:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"41c19c57-c016-4118-aec0-64545a5c106e","html_url":"https://github.com/loopmode/bash-print","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/loopmode/bash-print","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loopmode%2Fbash-print","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loopmode%2Fbash-print/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loopmode%2Fbash-print/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loopmode%2Fbash-print/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/loopmode","download_url":"https://codeload.github.com/loopmode/bash-print/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loopmode%2Fbash-print/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33617718,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-28T02:00:06.440Z","response_time":99,"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":[],"created_at":"2024-11-11T01:28:17.425Z","updated_at":"2026-05-28T16:31:12.504Z","avatar_url":"https://github.com/loopmode.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bash-print\n\nHelper for printing messages in colored blocks.\n\n\u003cimg src=\"https://github.com/loopmode/bash-print/raw/master/demo.gif\" /\u003e\n\n## Usage:\n\nInclude the script in your bash script, for example using `source`.\nThen, use `print_info`, `print_success` or `print_error`.\n\n- `print_info`: Prints message in a \u003cspan style=\"background: deepskyblue; color: white; padding: 0px 3px 1px;\"\u003eblue\u003c/span\u003e block\n- `print_success`: Prints message in a \u003cspan style=\"background: limegreen; color: white; padding: 0px 3px 1px;\"\u003eblue\u003c/span\u003e block\n- `print_error`: Prints message in a \u003cspan style=\"background: darkred; color: white; padding: 0px 3px 1px;\"\u003ered\u003c/span\u003e block\n- `print_block`: Prints message in a colored block. You __must__ pass an ansi color as __last__ argument \n\nBy default, a block starts and ends with a blank line.\nWhen printing multiple blocks, pass `+` after the message to avoid duplicate linebreaks.\n\n\n## Example\n\nUsing predefined colors:\n```\nsource print.sh\nprint_error \"Invalid target \\\"$TARGET\\\"\" + \nprint_info \"Usage: watch \u003cclient|server|all\u003e\"\n```\n\n\nUsing `print_block` and custom ansi color codes:\n\n```\nsource print.sh\nprint_block \"Invalid target \\\"$TARGET\\\"\" + \"\\033[31m\"\nprint_block \"Usage: watch \u003cclient|server|all\u003e\" + \"\\e[46m\"\n```\n## Known limitations\n\n### $JOIN_PARAM\n\nEven a single quoted string passed to the function is treated as an array of many strings separated by spaces.\nThus, the join mechanism that uses the magic rule \"Last argument is a `+`\" gets confused and fails when printing messages that themselves end with a `+`.\nIn that case, the plus is simply not displayed and instead the trailing linebreak is omitted on the block.\n\n```\n# both are treated the same way\nprint_info \"foo +\"\nprint_info \"foo\" +\n```\n\nNormally, this is not an issue at all, but you can still change script to something else if needed (Change the `JOIN_PARAM=\"+\"` line at the top).\n\n### Including the script\n\nIf `source print.sh` and `source ./print.sh` fail on your system, you can go the more reliable but also verbose way using the  directory of the running script:\n\n```\n# Assumes that print.sh is in the same directory as the running script\nDIR=\"$( cd \"$( dirname \"${BASH_SOURCE[0]}\" )\" \u0026\u0026 pwd )\"\nsource $DIR/print.sh\n\nprint_success \"It works!\"\n```\n\n ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floopmode%2Fbash-print","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Floopmode%2Fbash-print","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floopmode%2Fbash-print/lists"}