fixes
This commit is contained in:
31
CLI.py
31
CLI.py
@@ -886,33 +886,10 @@ def _execute_pipeline(tokens: list):
|
||||
source_args = ctx.get_last_result_table_source_args()
|
||||
|
||||
if source_cmd == 'search-file' and source_args and 'youtube' in source_args:
|
||||
print(f"Auto-piping YouTube selection to .pipe")
|
||||
# We can't modify stages here easily as we are outside the loop or before it?
|
||||
# Actually, this block runs BEFORE the loop if stages[0] is a selection.
|
||||
# But wait, the loop iterates over stages.
|
||||
# If we are here, it means we handled the selection by filtering `piped_result`.
|
||||
# The loop will then execute stages starting from 0?
|
||||
# No, `_execute_pipeline` logic is complex.
|
||||
|
||||
# Let's look at where this block is.
|
||||
# It is inside `_execute_pipeline`.
|
||||
# It runs if `first_stage_selection_indices` is set (meaning stages[0] was a selection).
|
||||
# And `command_expanded` is False (meaning we didn't replace stages[0] with a command).
|
||||
|
||||
# If we are here, `piped_result` holds the selected item(s).
|
||||
# The loop below iterates `for stage_index, stage_tokens in enumerate(stages):`
|
||||
# But we removed the first stage from `stages`? No.
|
||||
|
||||
# Wait, let's check how `first_stage_selection_indices` is used.
|
||||
# It seems `stages` is modified earlier?
|
||||
# "if stages and stages[0] and stages[0][0].startswith('@'): ... stages.pop(0)"
|
||||
|
||||
# Yes, lines 750-760 (approx) pop the first stage if it is a selection.
|
||||
# So `stages` now contains the REST of the pipeline.
|
||||
# If user typed just `@1`, `stages` is now empty `[]`.
|
||||
|
||||
# So if we want to pipe to `.pipe`, we should append `.pipe` to `stages`.
|
||||
stages.append(['.pipe'])
|
||||
# Only auto-pipe if no other stages follow (stages is empty because we popped the selection)
|
||||
if not stages:
|
||||
print(f"Auto-piping YouTube selection to .pipe")
|
||||
stages.append(['.pipe'])
|
||||
|
||||
else:
|
||||
print(f"No items matched selection in pipeline\n")
|
||||
|
||||
Reference in New Issue
Block a user