Regex & Priority Events¶
Switchboard Pro
The --regex-pattern
& priority
flags are a GoReleaser Pro feature.
You will need to purchase a license for switchboard-pro
before using this feature.
Below is an example of how you can use a regex pattern to match for very specific file names in events. In conjunction with this, you can set a priority value on each watcher to determine the order of precendence in which the events should be processed.
The below watcher will try and match for a txt document that matches the filename, and it will process that event first before any other.
pollingInterval: 10
watchers:
- path: "/home/user/Downloads"
destination: "/home/user/Documents"
ext: ".txt"
pattern: "(?i)(financial-report-[a-z]+-[0-9]+.txt)"
priority: 0
- path: "/home/user/Downloads"
destination: "/home/user/Videos"
ext: ".mp4"
priority: 1
Priority¶
Info
If you plan to use priority attributes in the context of multiple watchers from a config file, you need to ensure you add a priority to every watcher in the list.
Priority values are in descending order. In this case 0
is the highest priority watcher.