Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add file-based pattern support #1142

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mattjoyce
Copy link
Contributor

What this Pull Request (PR) does

Add file-based pattern support

This PR adds the ability to load patterns directly from files using explicit path prefixes, making it easier to test and iterate on patterns without requiring installation into the fabric config structure.

Why

Currently, to test a pattern it needs to be instantiated in the fabric config file structure. This change allows for quicker testing and iteration of patterns directly from files.

What

  • Adds support for loading patterns from files using explicit path prefixes
  • Maintains full backwards compatibility with named patterns
  • Handles common path formats:
    • Relative paths (./pattern.txt, ../pattern.txt)
    • Home directory (~/patterns/test.txt)
    • Absolute paths (/path/to/pattern.txt)

How

Use explicit path prefixes to distinguish file paths from pattern names:

# From files
fabric --pattern ./draft-pattern.txt
fabric --pattern ~/patterns/my-pattern.txt
fabric --pattern ../../shared-patterns/test.txt

# Existing pattern behavior remains unchanged
fabric --pattern patternname

Allow patterns to be loaded directly from files using explicit path prefixes
(~/, ./, /, or \). This enables easier testing and iteration of patterns
without requiring installation into the fabric config structure.

- Supports relative paths (./pattern.txt, ../pattern.txt)
- Supports home directory expansion (~/patterns/test.txt)
- Supports absolute paths
- Maintains backwards compatibility with named patterns
- Requires explicit path markers to distinguish from pattern names

Example usage:
  fabric --pattern ./draft-pattern.txt
  fabric --pattern ~/patterns/my-pattern.txt
  fabric --pattern ../../shared-patterns/test.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant