This commit is contained in:
nose
2025-12-12 21:55:38 -08:00
parent e2ffcab030
commit 85750247cc
78 changed files with 5726 additions and 6239 deletions

View File

@@ -1,6 +1,6 @@
"""Pipeline execution context and state management for cmdlets.
"""Pipeline execution context and state management for cmdlet.
This module provides functions for managing pipeline state, allowing cmdlets to
This module provides functions for managing pipeline state, allowing cmdlet to
emit results and control printing behavior within a piped execution context.
Key Concepts:
@@ -76,7 +76,7 @@ _PIPELINE_LAST_SELECTION: List[int] = []
# Track the currently executing command/pipeline string for worker attribution
_PIPELINE_COMMAND_TEXT: str = ""
# Shared scratchpad for cmdlets/funacts to stash structured data between stages
# Shared scratchpad for cmdlet/funacts to stash structured data between stages
_PIPELINE_VALUES: Dict[str, Any] = {}
_PIPELINE_MISSING = object()
@@ -128,8 +128,8 @@ def emit(obj: Any) -> None:
def emit_list(objects: List[Any]) -> None:
"""Emit a list of objects to the next pipeline stage.
This allows cmdlets to emit multiple results that are tracked as a list,
enabling downstream cmdlets to process all of them or filter by metadata.
This allows cmdlet to emit multiple results that are tracked as a list,
enabling downstream cmdlet to process all of them or filter by metadata.
Args:
objects: List of objects to emit
@@ -143,7 +143,7 @@ def print_if_visible(*args: Any, file=None, **kwargs: Any) -> None:
- Always allow errors printed to stderr by callers (they pass file=sys.stderr).
- For normal info messages, this suppresses printing for intermediate pipeline stages.
- Use this instead of log() in cmdlets when you want stage-aware output.
- Use this instead of log() in cmdlet when you want stage-aware output.
Args:
*args: Arguments to print (same as built-in print)
@@ -426,7 +426,7 @@ def get_ui_library_refresh_callback() -> Optional[Any]:
def trigger_ui_library_refresh(library_filter: str = 'local') -> None:
"""Trigger a library refresh in the UI if callback is registered.
This should be called from cmdlets/funacts after content is added to library.
This should be called from cmdlet/funacts after content is added to library.
Args:
library_filter: Which library to refresh ('local', 'hydrus', etc)
@@ -732,7 +732,7 @@ def get_last_result_table_row_selection_args(row_index: int) -> Optional[List[st
def set_current_stage_table(result_table: Optional[Any]) -> None:
"""Store the current pipeline stage table for @N expansion.
Used by cmdlets that display tabular results (e.g., download-data with formats)
Used by cmdlet that display tabular results (e.g., download-data with formats)
to make their result table available for @N expansion logic.
Does NOT push to history - purely for command expansion in the current pipeline.