{"id":22316681,"url":"https://github.com/developerstoolbox/trapper","last_synced_at":"2025-09-21T02:08:28.729Z","repository":{"id":114323653,"uuid":"375365675","full_name":"DevelopersToolbox/trapper","owner":"DevelopersToolbox","description":"An error trapper plugin for helping to debug bash scripts.","archived":false,"fork":false,"pushed_at":"2025-09-01T07:58:38.000Z","size":249,"stargazers_count":2,"open_issues_count":3,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-09-01T10:02:14.946Z","etag":null,"topics":["bash","bash-debugging","trapper","wolfsoftware"],"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/DevelopersToolbox.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":".github/CODEOWNERS","security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["WolfSoftware","TGWolf"]}},"created_at":"2021-06-09T13:30:01.000Z","updated_at":"2025-09-01T07:55:08.000Z","dependencies_parsed_at":"2024-07-22T06:23:39.881Z","dependency_job_id":"364afcfa-643a-4da4-b576-65f515f7639a","html_url":"https://github.com/DevelopersToolbox/trapper","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/DevelopersToolbox/trapper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevelopersToolbox%2Ftrapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevelopersToolbox%2Ftrapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevelopersToolbox%2Ftrapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevelopersToolbox%2Ftrapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DevelopersToolbox","download_url":"https://codeload.github.com/DevelopersToolbox/trapper/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevelopersToolbox%2Ftrapper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273724853,"owners_count":25156597,"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-09-05T02:00:09.113Z","response_time":402,"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","bash-debugging","trapper","wolfsoftware"],"created_at":"2024-12-03T23:07:26.886Z","updated_at":"2025-09-21T02:08:28.684Z","avatar_url":"https://github.com/DevelopersToolbox.png","language":"Shell","readme":"\u003c!-- markdownlint-disable --\u003e\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/DevelopersToolbox/\"\u003e\n        \u003cimg src=\"https://cdn.wolfsoftware.com/assets/images/github/organisations/developerstoolbox/black-and-white-circle-256.png\" alt=\"DevelopersToolbox logo\" /\u003e\n    \u003c/a\u003e\n    \u003cbr /\u003e\n    \u003ca href=\"https://github.com/DevelopersToolbox/trapper/actions/workflows/cicd.yml\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/actions/workflow/status/DevelopersToolbox/trapper/cicd.yml?branch=master\u0026label=build%20status\u0026style=for-the-badge\" alt=\"Github Build Status\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/DevelopersToolbox/trapper/blob/master/LICENSE.md\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/license/DevelopersToolbox/trapper?color=blue\u0026label=License\u0026style=for-the-badge\" alt=\"License\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/DevelopersToolbox/trapper\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/created-at/DevelopersToolbox/trapper?color=blue\u0026label=Created\u0026style=for-the-badge\" alt=\"Created\"\u003e\n    \u003c/a\u003e\n    \u003cbr /\u003e\n    \u003ca href=\"https://github.com/DevelopersToolbox/trapper/releases/latest\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/v/release/DevelopersToolbox/trapper?color=blue\u0026label=Latest%20Release\u0026style=for-the-badge\" alt=\"Release\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/DevelopersToolbox/trapper/releases/latest\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/release-date/DevelopersToolbox/trapper?color=blue\u0026label=Released\u0026style=for-the-badge\" alt=\"Released\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/DevelopersToolbox/trapper/releases/latest\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/commits-since/DevelopersToolbox/trapper/latest.svg?color=blue\u0026style=for-the-badge\" alt=\"Commits since release\"\u003e\n    \u003c/a\u003e\n    \u003cbr /\u003e\n    \u003ca href=\"https://github.com/DevelopersToolbox/trapper/blob/master/.github/CODE_OF_CONDUCT.md\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Code%20of%20Conduct-blue?style=for-the-badge\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/DevelopersToolbox/trapper/blob/master/.github/CONTRIBUTING.md\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Contributing-blue?style=for-the-badge\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/DevelopersToolbox/trapper/blob/master/.github/SECURITY.md\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Report%20Security%20Concern-blue?style=for-the-badge\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/DevelopersToolbox/trapper/issues\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Get%20Support-blue?style=for-the-badge\" /\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n## Overview\n\nAt Wolf Software we write a lot of bash scripts for many purposes and the one thing that we found lacking was a simple to use debugging tool. \n\nTrapper is something that weas developed originally for internal use to debug scripts we release with the aim being a simple plugin that required minimal changes to the original script.\n\nTrapper is capable of capturing a large array of runtime errors and attempts to point to where the error happened.\n\n## Usage\n\nSimply source trapper at the top of your script and then execute it as normal. \n\nTrapper works by setting a trap for any errors and attempts to display where the errors happened.\n\n\u003e Truncated snippet\n```\nset -Eeuo pipefail\n\nfunction trap_with_arg()\n{\n    func=\"$1\";\n    shift\n\n    for sig ; do\n        # shellcheck disable=SC2064\n        trap \"$func $sig\" \"$sig\"\n    done\n}\n\ntrap_with_arg 'failure ${?}' ERR EXIT\n```\n\nIt is capable of detecting errors in a many different scenarios.\n\n| Scenario          | Requirements                               | Results                                                                                |\n| ----------------- | ------------------------------------------ | -------------------------------------------------------------------------------------- |\n| Single script     | Include trapper.sh                         | Reports filename, line number and code snippet.                                        |\n| Executing scripts | Include trapper.sh (in all scripts)        | Reports filename, line number and code snippet for full stack trace (calling scripts). |\n| Including scripts | Include trapper.sh (only in parent script) | Reports filename, line number and code snippet of the failing included script.         |\n\n## Examples\n\n### Testing for unset (unbound) variables\n\nSingle script attempt to use an unbound variable.\n\n[Source](tests/unbounded/unbounded.sh)\n\n![Unbounded](screenshots/unbound.png)\n\n### Testing execute stack (scripts calling scripts)\n\nParent script executing child script with error in the final child.\n\n[Source](tests/execute-stack/parent.sh)\n\n![Execute Stack](screenshots/execute-stack.png)\n\n### Testing source stack (scripts including scripts)\n\nParent script including (sourcing) child scripts with an error in the final child.\n\n[Source](tests/source-stack/parent.sh)\n\n![Execute Stack](screenshots/source-stack.png)\n\n\u003cbr /\u003e\n\u003cp align=\"right\"\u003e\u003ca href=\"https://wolfsoftware.com/\"\u003e\u003cimg src=\"https://img.shields.io/badge/Created%20by%20Wolf%20on%20behalf%20of%20Wolf%20Software-blue?style=for-the-badge\" /\u003e\u003c/a\u003e\u003c/p\u003e\n","funding_links":["https://github.com/sponsors/WolfSoftware","https://github.com/sponsors/TGWolf"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeveloperstoolbox%2Ftrapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeveloperstoolbox%2Ftrapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeveloperstoolbox%2Ftrapper/lists"}