{"id":22870326,"url":"https://github.com/berquerant/help-bash","last_synced_at":"2025-10-07T07:52:49.483Z","repository":{"id":81890025,"uuid":"575392067","full_name":"berquerant/help-bash","owner":"berquerant","description":"Displays the things like documentation comments in .sh file","archived":false,"fork":false,"pushed_at":"2022-12-09T22:22:59.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-31T11:31:13.211Z","etag":null,"topics":["bash"],"latest_commit_sha":null,"homepage":"","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/berquerant.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":"2022-12-07T12:10:47.000Z","updated_at":"2022-12-07T12:11:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"a6719092-715d-467c-a387-18fe4e0a981a","html_url":"https://github.com/berquerant/help-bash","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/berquerant/help-bash","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berquerant%2Fhelp-bash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berquerant%2Fhelp-bash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berquerant%2Fhelp-bash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berquerant%2Fhelp-bash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/berquerant","download_url":"https://codeload.github.com/berquerant/help-bash/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berquerant%2Fhelp-bash/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278740821,"owners_count":26037480,"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-10-07T02:00:06.786Z","response_time":59,"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":["bash"],"created_at":"2024-12-13T13:14:32.454Z","updated_at":"2025-10-07T07:52:49.461Z","avatar_url":"https://github.com/berquerant.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# help-bash.sh\n\n```\n❯ ./help-bash.sh -h\nhelp-bash.sh displays the things like documentation comments in .sh file.\n\nUSAGE:\n  help-bash.sh [OPTIONS] [PATH]\n\n\nARGS:\n    \u003cPATH\u003e\n        A file to display documentations.\n\n\nOPTIONS:\n    -f\n        Displays top-level (outside of any statements) functions documentations.\n    -r\n        Displays top-level variables documentations.\n    -h\n        Prints help information.\n    -t\n        Threshold to determine whether to display the top-level comments.\n        e.g. the value is 3 then displays 3 or more lines of top-level comments.\n        Default is 3.\n\n\nENVIRONMENT VARIABLES:\n    AWK\n        awk command.\n    GREP\n        grep command.\n    HELP_BASH_DEBUG\n        If value is 1 then enables debug logs.\n\n\n\nhelp-bash.sh ends here.\n```\n\nAbove is equivalent to `./help-bash.sh ./help-bash.sh`.\n\nInclude variables and functions with comment of `help-bash.sh`:\n\n```\n❯ ./help-bash.sh -hfr\nhelp-bash.sh displays the things like documentation comments in .sh file.\n\nUSAGE:\n  help-bash.sh [OPTIONS] [PATH]\n\n\nARGS:\n    \u003cPATH\u003e\n        A file to display documentations.\n\n\nOPTIONS:\n    -f\n        Displays top-level (outside of any statements) functions documentations.\n    -r\n        Displays top-level variables documentations.\n    -h\n        Prints help information.\n    -t\n        Threshold to determine whether to display the top-level comments.\n        e.g. the value is 3 then displays 3 or more lines of top-level comments.\n        Default is 3.\n\n\nENVIRONMENT VARIABLES:\n    AWK\n        awk command.\n    GREP\n        grep command.\n    HELP_BASH_DEBUG\n        If value is 1 then enables debug logs.\n\nVariable:debug=\"${HELP_BASH_DEBUG:-0}\"\nFor envvar HELP_BASH_DEBUG.\n\nVariable:toplevel=3\nFor -t option.\n\nVariable:needfunc=0\nFor -f option.\n\nVariable:needvar=0\nFor -r option.\n\nVariable:do_help=false\nFor -h option.\n\nVariable:exit_status=0\nExit status of this script.\n\nFunction:dbg()\nPrint debug log when debug is 1.\n\nFunction:display_docs()\nFind top-level comments and print them.\n\nExamples:\n\nTop-level comment, threshold (-t) is 3:\n\n# 1st\n# 2nd\n# 3rd\n\nthen outputs\n\n1st\n2nd\n3rd\n\nTop-level function:\n\n# desc1\n# desc2\nfunc() {\n...\n\nthen outputs\n\nFunction:func()\ndesc1\ndesc2\n\nTop-level variable:\n\n# desc1\n# desc2\nvar=1\n\nthen outputs\n\nVariable:var=1\ndesc1\ndesc2\n\nFunction:print_usage()\nPrint usage of this script.\n\nFunction:is_natural()\nReturn status 1 if given argument $1 is a natural integer.\n\nVariable:readonly target_file=\"$1\"\nFile to display documentations.\nEmpty means stdin.\n\n\n\nhelp-bash.sh ends here.\n```\n\n# Requirements\n\n- GNU bash, 5.2.9(1)-release (aarch64-apple-darwin22.1.0)\n- GNU Awk 5.2.0, API 3.2, (GNU MPFR 4.1.0-p13, GNU MP 6.2.1)\n- grep (BSD grep, GNU compatible) 2.6.0-FreeBSD\n\n# Development\n\n- [Run unit tests](./run-test.sh)\n- [Generate golden testdata](./generate-golden.sh)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberquerant%2Fhelp-bash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fberquerant%2Fhelp-bash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberquerant%2Fhelp-bash/lists"}