cmds.pkg.CmdSelect: Load path filter dynamically

The select command names PackageFilterString directly, but the filter is a
spec string and the class is resolved dynamically by the loader. Build the
filter through PathFilter.create() so the concrete class no longer appears
at the call site.

Signed-off-by: Jan Lindemann <jan@janware.com>
Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v1.5.0
This commit is contained in:
Jan Lindemann 2026-11-03 15:21:29 +01:00
commit 685ed51935
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61

View file

@ -2,7 +2,7 @@ from __future__ import annotations
from typing import TYPE_CHECKING, override
from ...lib.PackageFilter import PackageFilterString
from ...lib.PathFilter import PathFilter
from .Cmd import Cmd, Parent
if TYPE_CHECKING:
@ -20,8 +20,8 @@ class CmdSelect(Cmd): # export
@override
async def _run(self, args: Namespace) -> None:
filter = PackageFilterString(
file_context = self.app.exec_context, spec = args.filter
filter = PathFilter.create(
spec = args.filter, file_context = self.app.exec_context
) if args.filter else None
if filter is not None:
from ...lib.PackageFilter import PackageFilter