This commit is contained in:
2026-01-05 07:51:19 -08:00
parent 8545367e28
commit 1f765cffda
32 changed files with 3447 additions and 3250 deletions

View File

@@ -345,6 +345,14 @@ class Add_File(Cmdlet):
else:
items_to_process = [result]
total_items = len(items_to_process) if isinstance(items_to_process, list) else 0
processed_items = 0
try:
if total_items:
progress.set_percent(0)
except Exception:
pass
# Minimal step-based progress for single-item runs.
# Many add-file flows don't emit intermediate items, so without steps the pipe can look "stuck".
use_steps = False
@@ -496,9 +504,25 @@ class Add_File(Cmdlet):
and len(items_to_process) > 1
)
for item in items_to_process:
for idx, item in enumerate(items_to_process, 1):
pipe_obj = coerce_to_pipe_object(item, path_arg)
try:
label = pipe_obj.title or pipe_obj.name
if not label and pipe_obj.path:
try:
label = Path(str(pipe_obj.path)).name
except Exception:
label = pipe_obj.path
if not label:
label = "file"
if total_items:
pending_pct = int(round(((idx - 1) / max(1, total_items)) * 100))
progress.set_percent(pending_pct)
progress.set_status(f"adding {idx}/{total_items}: {label}")
except Exception:
pass
temp_dir_to_cleanup: Optional[Path] = None
delete_after_item = delete_after
try:
@@ -597,6 +621,14 @@ class Add_File(Cmdlet):
shutil.rmtree(temp_dir_to_cleanup, ignore_errors=True)
except Exception:
pass
processed_items += 1
try:
pct = int(round((processed_items / max(1, total_items)) * 100))
progress.set_percent(pct)
if processed_items >= total_items:
progress.clear_status()
except Exception:
pass
# Apply deferred url associations (bulk) before showing the final store table.
if pending_url_associations: