{"id":33939153,"url":"https://github.com/lmapii/globmatch","last_synced_at":"2026-04-02T02:17:02.053Z","repository":{"id":39907060,"uuid":"473157843","full_name":"lmapii/globmatch","owner":"lmapii","description":"Rust crate for resolving globs relative to a specified directory.","archived":false,"fork":false,"pushed_at":"2026-03-09T15:28:30.000Z","size":68,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-12T02:10:07.335Z","etag":null,"topics":["glob","globset","walkdir"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/lmapii.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}},"created_at":"2022-03-23T11:28:37.000Z","updated_at":"2026-03-09T15:28:32.000Z","dependencies_parsed_at":"2024-01-15T09:10:01.823Z","dependency_job_id":"8a19c56d-6c23-460e-99bb-bd6fdce53f3f","html_url":"https://github.com/lmapii/globmatch","commit_stats":{"total_commits":56,"total_committers":3,"mean_commits":"18.666666666666668","dds":0.2142857142857143,"last_synced_commit":"1b0b09d2cb6a91c2026db6d08b2b4e07899e1d3a"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/lmapii/globmatch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lmapii%2Fglobmatch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lmapii%2Fglobmatch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lmapii%2Fglobmatch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lmapii%2Fglobmatch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lmapii","download_url":"https://codeload.github.com/lmapii/globmatch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lmapii%2Fglobmatch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31294479,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T01:43:37.129Z","status":"online","status_checked_at":"2026-04-02T02:00:08.535Z","response_time":89,"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":["glob","globset","walkdir"],"created_at":"2025-12-12T15:14:34.324Z","updated_at":"2026-04-02T02:17:02.037Z","avatar_url":"https://github.com/lmapii.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# globmatch\n\n[![Build status](https://github.com/lmapii/globmatch/workflows/ci/badge.svg)](https://github.com/lmapii/globmatch/actions)\n\nRust crate for resolving globs relative to a specified directory. Based on [globset][globset] and [walkdir][walkdir].\n\n## Documentation\n\n[https://docs.rs/globmatch](https://docs.rs/globmatch)\n\nFor the documentation of the glob format please refer to\n\n[https://docs.rs/globset](https://docs.rs/globset)\n\n## Usage\n\nAdd this to your `Cargo.toml`:\n\n```toml\n[dependencies]\nglobmatch = \"0.3\"\n```\n\n## Examples and concept\n\n\nFor CLI utilities it can be a common pattern to operate on a set of files. Such a set of files is either provided directly, as parameter to the tool - or via configuration files.\n\nThe use of a configuration file makes it easier to determine the location of a file since the path can be specified relative to the configuration. Consider, e.g., the following `.json` input:\n\n```json,no_run\n{\n  \"globs\": [\n    \"../../../some/text-files/**/*.txt\",\n    \"other/inputs/*.md\",\n    \"paths/from/dir[0-9]/*.*\"\n  ]\n}\n```\n\nSpecifying these paths in a dedicated configuration file allows to resolve the paths independent of the invocation of the script operating on these files, the location of the configuration file is used as base directory. This crate combines the features of the existing crates [globset][globset] and [walkdir][walkdir] to implement a *relative glob matcher*.\n\n### Example: A simple match.\n\nThe following example uses the files stored in the `test-files/c-simple` folder, we're trying to match all the `.txt` files using the glob `test-files/c-simple/**/*.txt` (where `test-files/c-simple` is the only relative path component).\n\n```rust\n\n/*\n    Example files:\n    globmatch/test-files/c-simple/.hidden\n    globmatch/test-files/c-simple/.hidden/h_1.txt\n    globmatch/test-files/c-simple/.hidden/h_0.txt\n    globmatch/test-files/c-simple/a/a2/a2_0.txt\n    globmatch/test-files/c-simple/a/a0/a0_0.txt\n    globmatch/test-files/c-simple/a/a0/a0_1.txt\n    globmatch/test-files/c-simple/a/a0/A0_3.txt\n    globmatch/test-files/c-simple/a/a0/a0_2.md\n    globmatch/test-files/c-simple/a/a1/a1_0.txt\n    globmatch/test-files/c-simple/some_file.txt\n    globmatch/test-files/c-simple/b/b_0.txt\n */\n\nuse globmatch;\n\nfn example_a() -\u003e Result\u003c(), String\u003e {\n    let builder = globmatch::Builder::new(\"test-files/c-simple/**/*.txt\")\n        .build(env!(\"CARGO_MANIFEST_DIR\"))?;\n\n    let paths: Vec\u003c_\u003e = builder.into_iter()\n        .flatten()\n        .collect();\n\n    println!(\n        \"paths:\\n{}\",\n        paths\n            .iter()\n            .map(|p| format!(\"{}\", p.to_string_lossy()))\n            .collect::\u003cVec\u003c_\u003e\u003e()\n            .join(\"\\n\")\n    );\n\n    assert_eq!(6 + 2 + 1, paths.len());\n    Ok(())\n}\n\nexample_a().unwrap();\n```\n\n### Example: Specifying options and using `.filter_entry`.\n\nSimilar to the builder pattern in [globset][globset] when using `globset::GlobBuilder`, this crate allows to pass options (currently just case sensitivity) to the builder.\n\nIn addition, the `filter_entry` function from [walkdir][walkdir] is accessible, but only as a single call (this crate does not implement a recursive iterator). This function allows filter files and folders *before* matching against the provided glob and therefore to efficiently exclude files and folders, e.g., hidden folders:\n\n ```rust\nuse globmatch;\n\nfn example_b() -\u003e Result\u003c(), String\u003e {\n    let root = env!(\"CARGO_MANIFEST_DIR\");\n    let pattern = \"test-files/c-simple/**/[ah]*.txt\";\n\n    let builder = globmatch::Builder::new(pattern)\n        .case_sensitive(true)\n        .build(root)?;\n\n    let paths: Vec\u003c_\u003e = builder\n        .into_iter()\n        .filter_entry(|p| !globmatch::is_hidden_entry(p))\n        .flatten()\n        .collect();\n\n    assert_eq!(4, paths.len());\n    Ok(())\n}\n\nexample_b().unwrap();\n ```\n\n[globset]: https://docs.rs/globset\n[walkdir]: https://docs.rs/walkdir","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flmapii%2Fglobmatch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flmapii%2Fglobmatch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flmapii%2Fglobmatch/lists"}