feat: add preset bool filter
This commit is contained in:
@@ -2,7 +2,7 @@ from collections import defaultdict
|
||||
from pathlib import Path
|
||||
|
||||
from ..common.template import PathTemplate
|
||||
from ..entry.detector import EntryDetector
|
||||
from ..entry.detector import ENTRY_NONE, ENTRY_SKIP, EntryDetector
|
||||
from ..entry.entry import Entry, TaskKey
|
||||
from .loader import PresetLoader, PresetLoaderConfig
|
||||
from .model import Variables
|
||||
@@ -13,11 +13,11 @@ class PresetEntryDetector(EntryDetector):
|
||||
def __init__(self, preset_loader_config: PresetLoaderConfig | None = None):
|
||||
self._preset_loader_config = preset_loader_config
|
||||
|
||||
def detect_entry(self, basepath: Path) -> Entry | None:
|
||||
def detect_entry(self, basepath: Path) -> Entry:
|
||||
template = PathTemplate(basepath)
|
||||
preset = PresetLoader(basepath, self._preset_loader_config).load()
|
||||
if preset.skip:
|
||||
return None
|
||||
return ENTRY_SKIP
|
||||
tasks = defaultdict(list)
|
||||
for tag, preset in preset.presets.items():
|
||||
preset_variables: Variables = {"entry_path": basepath}
|
||||
@@ -41,4 +41,4 @@ class PresetEntryDetector(EntryDetector):
|
||||
]
|
||||
if tasks:
|
||||
return Entry(tasks, basepath)
|
||||
return None
|
||||
return ENTRY_NONE
|
||||
|
||||
Reference in New Issue
Block a user