{"id":20621060,"url":"https://github.com/mmcquillan/matcher","last_synced_at":"2026-03-07T22:32:47.216Z","repository":{"id":57496122,"uuid":"132294916","full_name":"mmcquillan/matcher","owner":"mmcquillan","description":"A library for parsing and matching based on a mask for use with CLI or Bots.","archived":false,"fork":false,"pushed_at":"2020-04-13T13:53:41.000Z","size":15,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-14T03:38:20.963Z","etag":null,"topics":["bot","cli","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","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/mmcquillan.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}},"created_at":"2018-05-06T00:37:02.000Z","updated_at":"2023-07-08T01:23:47.000Z","dependencies_parsed_at":"2022-09-02T20:22:40.623Z","dependency_job_id":null,"html_url":"https://github.com/mmcquillan/matcher","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mmcquillan/matcher","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmcquillan%2Fmatcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmcquillan%2Fmatcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmcquillan%2Fmatcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmcquillan%2Fmatcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mmcquillan","download_url":"https://codeload.github.com/mmcquillan/matcher/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmcquillan%2Fmatcher/sbom","scorecard":{"id":654274,"data":{"date":"2025-08-11","repo":{"name":"github.com/mmcquillan/matcher","commit":"5b76eecd30c9b294de41d4eac942ef11411d36e9"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.2,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":1,"reason":"Found 1/9 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-21T14:15:33.502Z","repository_id":57496122,"created_at":"2025-08-21T14:15:33.502Z","updated_at":"2025-08-21T14:15:33.502Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30234666,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T19:01:10.287Z","status":"ssl_error","status_checked_at":"2026-03-07T18:59:58.103Z","response_time":53,"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":["bot","cli","golang"],"created_at":"2024-11-16T12:16:31.455Z","updated_at":"2026-03-07T22:32:47.179Z","avatar_url":"https://github.com/mmcquillan.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Matcher\n\nA library for parsing and matching based on a mask for use with CLI or Bots.\n\n\n## Mask Rules\n\n- `xyz` text xyz\n- `\u003cxyz\u003e` required var named xyz\n- `[xyz]` optional var named xyz\n- `[xyz...]` optional var named xyz and captures remaining input\n- `[xyz(string:foo,bar)]` optional var named xyz that can only be foo or bar\n- `\u003c-xyz\u003e` required short flag named xyz\n- `[-xyz]` optional short flag named xyz\n- `[-]` capture any short flag\n- `\u003c--xyz\u003e` required long flag named xyz\n- `[--xyz]` optional long flag named xyz\n- `[--]` capture any long flag\n\n\n## Examples\n\n| Mask                              | Input                       | Match |\n| --------------------------------- | --------------------------- | ----- |\n| `run`                             | `run`                       | true  |\n| `run`                             | `walk`                      | false |\n| `run \u003cspeed\u003e [distance]`          | `run fast`                  | true  |\n| `run \u003cspeed\u003e [distance]`          | `run fast far`              | true  |\n| `run \u003cspeed\u003e [distance]`          | `run fast far forever`      | false |\n| `run \u003cspeed\u003e [distance]`          | `run fast \"far forever\"`    | true  |\n| `run \u003cspeed\u003e [distance] \u003c-j\u003e`     | `run fast far -j`           | true  |\n| `run \u003cspeed\u003e [distance] \u003c-j\u003e`     | `run fast far`              | false |\n| `run \u003cspeed\u003e [distance] \u003c--jump\u003e` | `run fast far --jump=high`  | true  |\n| `run \u003cspeed\u003e [distance] \u003c--jump\u003e` | `run fast far`              | false |\n| `run \u003cspeed\u003e [distance] [--jump]` | `run fast far --jump=high`  | true  |\n| `run \u003cspeed\u003e [distance] [--jump]` | `run fast far`              | true  |\n| `run \u003cspeed\u003e [distance] [--jump]` | `run fast far --skip`       | false |\n| `run \u003cspeed\u003e [distance] [--]`     | `run fast --jump --skip`    | true  |\n| `run [song...]`                   | `run Welcome to the Jungle` | true  |\n| `run \u003cspeed(string)\u003e`             | `run fast`                  | true  |\n| `run \u003cspeed(string:fast,slow)\u003e`   | `run fast`                  | true  |\n| `run \u003cspeed(string:fast,slow)\u003e`   | `run quickly`               | false |\n| `run \u003cspeed(int)\u003e`                | `run 6`                     | true  |\n| `run \u003cspeed(int:0,2,4,6)\u003e`        | `run 6`                     | true  |\n| `run \u003cspeed(int:0,2,4,6)\u003e`        | `run 3`                     | false |\n| `run \u003c--jump(bool)\u003e`              | `run --jump`                | true  |\n| `run \u003c--jump(bool)\u003e`              | `run --jump=false`          | true  |\n\n\n## Matcher\n\n```\nmatch, command, values := matcher.Matcher(\"run \u003cspeed\u003e [distance]\", \"run fast far\")\nif match {\n\tfmt.Printf(\"Command:%v\\n\", command)\n\tfor k, v := range values {\n\t\tfmt.Printf(\"%v:%v\\n\", k, v)\n\t}\n\tfmt.Print(\"\\n\")\n}\n\n- - -\nCommand:run\nspeed:fast\ndistance:far\n```\n\n\n## Masker\n\n```\ntokens := matcher.Masker(\"run \u003cspeed\u003e [distance] [--jump]\")\nfor _, t := range tokens {\n\tfmt.Printf(\"Name:%v \", t.Name)\n\tfmt.Printf(\"Type:%v \", t.Type)\n\tfmt.Printf(\"Valid:%v \", t.Valid)\n\tfmt.Printf(\"Required:%v \", t.Required)\n\tfmt.Printf(\"Short Flag:%v \", t.ShortFlag)\n\tfmt.Printf(\"Long Flag:%v \", t.LongFlag)\n\tfmt.Printf(\"Remainder:%v\\n\", t.Remainder)\n}\n\n- - -\nName:run Type:text Valid:run Required:true Short Flag:false Long Flag:false Remainder:false\nName:speed Type:string Valid:* Required:true Short Flag:false Long Flag:false Remainder:false\nName:distance Type:string Valid:* Required:false Short Flag:false Long Flag:false Remainder:false\nName:jump Type:string Valid:* Required:false Short Flag:false Long Flag:true Remainder:false\n```\n\n\n## Parser\n\n```\nargs, shortFlags, longFlags := matcher.Parser(\"run far away --jump=high\")\nfor i, arg := range args {\n\tfmt.Printf(\"Arg %v: %v\\n\", i, arg)\n}\nfor _, flag := range longFlags {\n\tfmt.Printf(\"%v: %v\\n\", flag.Name, flag.Value)\n}\n\n- - -\nArg 0: run\nArg 1: far\nArg 2: away\njump: high\n```\n\n\n## Tokenize\n\n```\ntokens := matcher.Tokenize(\" run far away \")\nfor _, t := range tokens {\n\tfmt.Println(t)\n}\n\n- - -\nrun\nfar\naway\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmmcquillan%2Fmatcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmmcquillan%2Fmatcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmmcquillan%2Fmatcher/lists"}