{"id":16209158,"url":"https://github.com/gilzoide/wildcard_pattern-lua","last_synced_at":"2025-04-07T20:41:43.237Z","repository":{"id":70590894,"uuid":"286489578","full_name":"gilzoide/wildcard_pattern-lua","owner":"gilzoide","description":"Lua library for using shell-like wildcards as string patterns with support for importing gitignore-like file content","archived":false,"fork":false,"pushed_at":"2020-08-11T15:42:14.000Z","size":33,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-13T22:18:57.760Z","etag":null,"topics":["gitignore-files","ignore-list","lua","lua-library","wildcard"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gilzoide.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":"2020-08-10T13:56:26.000Z","updated_at":"2024-12-25T10:08:44.000Z","dependencies_parsed_at":"2023-06-09T22:00:39.485Z","dependency_job_id":null,"html_url":"https://github.com/gilzoide/wildcard_pattern-lua","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilzoide%2Fwildcard_pattern-lua","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilzoide%2Fwildcard_pattern-lua/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilzoide%2Fwildcard_pattern-lua/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilzoide%2Fwildcard_pattern-lua/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gilzoide","download_url":"https://codeload.github.com/gilzoide/wildcard_pattern-lua/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247728276,"owners_count":20986244,"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","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":["gitignore-files","ignore-list","lua","lua-library","wildcard"],"created_at":"2024-10-10T10:28:14.753Z","updated_at":"2025-04-07T20:41:43.210Z","avatar_url":"https://github.com/gilzoide.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wildcard\\_pattern.lua\n[![Build Status](https://travis-ci.org/gilzoide/wildcard_pattern.lua.svg?branch=master)](https://travis-ci.org/gilzoide/wildcard_pattern.lua)\n\nLua library for using shell-like wildcards as string patterns with support for importing gitignore-like file content.\n\n\n## Installation\nCopy `wildcard_pattern.lua` to your LUA\\_PATH or install with [LuaRocks](https://luarocks.org/):\n\n    $ luarocks install wildcard_pattern\n\n\n## Usage\n\n```lua\nlocal wildcard_pattern = require 'wildcard_pattern'\n\n-- Create simple lua string patterns from wildcard ones\nlocal patt = wildcard_pattern.from_wildcard(\"*.lua\")\nassert(string.match(\"hello_world.lua\", patt))\n\n-- Or import a gitignore-like content from file\nlocal ignore_patterns = wildcard_pattern.aggregate.from(io.open(\".gitignore\"))\n-- local ignore_patterns = wildcard_pattern.aggregate.from(io.open(\".gitignore\"):read('*a'))  -- or from text\n-- local ignore_patterns = wildcard_pattern.aggregate.from(io.lines(\".gitignore\"))  -- or from an iterator function\nassert(not wildcard_pattern.any_match(ignore_patterns, \"hello_world.lua\"))  -- assuming your .gitignore have no rules for ignoring hello_world.lua\n-- `any_match` is also a method and __call metamethod for ignore files\nassert(not ignore_patterns:any_match(\"hello_world.lua\"))\nassert(not ignore_patterns(\"hello_world.lua\"))\n\n-- You can extend your aggregate wildcard with `insert`, `extend` or `extend_from` methods\nignore_patterns:insert(\"hello_world.lua\")\nignore_patterns:extend(\"hello_world.lua\", \"hello_world[0-9].lua\")\nignore_patterns:extend_from([[\n# `extend_from` uses gitignore-like file content, just like `wildcard_pattern.aggregate.from`\nworld_hello?.lua\n**.ignore\n]])\n```\n\n\n## What is supported\n- A single asterisk `*` matches zero or more characters that are not directory separators `/`\n- Two consecutive asterisks `**` match zero or more characters\n- A question mark `?` match any character that is not a directory separator `/`\n- Brackets `[...]` denote character sets and ranges, like `[abcd]` and `[a-d]`\n- Brackets may be negated with an exclamation mark `[!...]`\n- Backslash `\\` escapes are maintained\n\n\n## What is not supported\n- Prefix exclamation mark `!` for negating the pattern in ignore files\n\n\n## Running tests\nRun tests using [busted](https://olivinelabs.com/busted/)\n\n    $ busted\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgilzoide%2Fwildcard_pattern-lua","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgilzoide%2Fwildcard_pattern-lua","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgilzoide%2Fwildcard_pattern-lua/lists"}