{"id":18310892,"url":"https://github.com/jimschubert/ignore","last_synced_at":"2025-04-09T12:10:29.768Z","repository":{"id":139902313,"uuid":"524734160","full_name":"jimschubert/ignore","owner":"jimschubert","description":null,"archived":false,"fork":false,"pushed_at":"2022-08-14T17:31:39.000Z","size":27,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-15T05:46:20.318Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jimschubert.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-08-14T17:17:40.000Z","updated_at":"2022-08-17T16:19:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"c97950b9-1716-4ec2-a673-6c4c48db03a9","html_url":"https://github.com/jimschubert/ignore","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimschubert%2Fignore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimschubert%2Fignore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimschubert%2Fignore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimschubert%2Fignore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jimschubert","download_url":"https://codeload.github.com/jimschubert/ignore/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248036066,"owners_count":21037092,"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":[],"created_at":"2024-11-05T16:15:48.374Z","updated_at":"2025-04-09T12:10:29.754Z","avatar_url":"https://github.com/jimschubert.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ignore\n\nA simple ignore file processor for Go.\n\nThis is a reimagining of [jimschubert/iggy](https://github.com/jimschubert/iggy).\n\n## Usage\n\nGiven an ignore file, for example `/your/directory/.gitignore`:\n\n```\n# This is an example ignore file\n\n# Match everything below this directory\npath/to/dir/**\n\n# Match all Test files with all extensions\n**/*Test*.*\n\n# Match files with one character filename and extension\n**/?.?\n\n# Match all files beginning with first or second\n**/{first*,second*}\n```\n\nThis file can be read and evaluated like this:\n\n```go\nprocessor, _ := NewProcessor()\nvar allow bool\nallow, _ = processor.AllowsFile(\"path/to/dir/ignored\") // = false\nallow, _ = processor.AllowsFile(\"other/path/to/dir/ignored\") // = false\nallow, _ = processor.AllowsFile(\"nested/test/SomeTest.java\") // = false\nallow, _ = processor.AllowsFile(\"nested/a.b\") // = false\nallow, _ = processor.AllowsFile(\"nested/abc.d\") // = true\nallow, _ = processor.AllowsFile(\"nested/first.txt\") // = false\nallow, _ = processor.AllowsFile(\"nested/second.txt\") // = false\nallow, _ = processor.AllowsFile(\"nested/third.txt\") // = true\n```\n\nThe `NewProcessor` function accepts functional parameters as defined in the ignore package.\n\nTo specify a custom path for the ignore file:\n\n```go\nprocessor, _ := NewProcessor(\n    WithIgnoreFilePath(\"/your/directory/.ignore\"),\n)\n```\n\nCurrently only Git's ignore rules are supported. As new strategies are added they can be targeted like this:\n\n```go\nprocessor, _ := NewProcessor(\n    WithGitignoreStrategy(),\n    WithIgnoreFilePath(\"/your/directory/.ignore\"),\n)\n```\n\n## Patterns\n\nFile patterns of the default ignore strategy follow closely to that of `.gitignore`.\n\n* Rooted file pattern: `/*.ext`\n    - Must exist in the root of the directory\n    - Must begin with a forward slash `/`\n    - Supports `*` or `*.ext` pattern\n* Directory Rule\n    - Matches against directories (`dir/`) or directory contents (`dir/**`)\n    - Must end in `/`\n* File Rule\n    - Matches an individual `filename` or `filename.ext`\n\nSimilar to `.gitignore` processing, a double asterisk (`**`) can be used in place of a directory to indicate recursion.\n\nFor example:\n\n```\npath\\to\\**\\file\n```\n\nmatches both `path\\to\\some\\file` and `path\\to\\some\\nested\\file`.\n\nSingle asterisks (`*`) match any characters within a pattern.\n\nFor example:\n\n```\npath\\to\\*file\n```\n\nmatches both `path\\to\\your_file` and `path\\to\\my_file`, as well as `path\\to\\file`.\n\n## Why?\n\nI mean… why not? Sometimes I want a simple way to ignore or force file processing in a directory, but I don't want to shell out to some other program to evaluate the logic.\n\n# License\n\nApache 2.0.\n\nsee [License](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjimschubert%2Fignore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjimschubert%2Fignore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjimschubert%2Fignore/lists"}