diff --git a/cmdlet/add_file.py b/cmdlet/add_file.py index 7353e14..5747493 100644 --- a/cmdlet/add_file.py +++ b/cmdlet/add_file.py @@ -370,6 +370,7 @@ class Add_File(Cmdlet): use_steps = False steps_started = False step2_done = False + step3_done = False try: ui, _ = progress.ui_and_pipe_index() use_steps = (ui is not None) and (len(items_to_process) == 1) @@ -538,6 +539,11 @@ class Add_File(Cmdlet): temp_dir_to_cleanup: Optional[Path] = None delete_after_item = delete_after try: + if use_steps and (not steps_started): + progress.begin_steps(4) + progress.step("resolving source") + steps_started = True + media_path, file_hash, temp_dir_to_cleanup = self._resolve_source( item, path_arg, pipe_obj, config, store_instance=storage_registry ) @@ -548,10 +554,9 @@ class Add_File(Cmdlet): failures += 1 continue - if use_steps and (not steps_started): - progress.begin_steps(3) - progress.step("resolving source") - steps_started = True + if use_steps and steps_started and (not step2_done): + progress.step("ingesting file") + step2_done = True # Update pipe_obj with resolved path pipe_obj.path = str(media_path) @@ -619,10 +624,6 @@ class Add_File(Cmdlet): failures += 1 continue - if use_steps and steps_started and (not step2_done): - progress.step("writing destination") - step2_done = True - if code == 0: successes += 1 else: @@ -670,6 +671,10 @@ class Add_File(Cmdlet): seen: set[str] = set() hashes = [h for h in hashes if not (h in seen or seen.add(h))] + if use_steps and steps_started and (not step3_done): + progress.step("refreshing display") + step3_done = True + refreshed_items = Add_File._try_emit_search_file_by_hashes( store=str(location), hash_values=hashes, @@ -704,6 +709,8 @@ class Add_File(Cmdlet): if use_steps and steps_started: progress.step("finalized") + # Clear the status so it doesn't linger in the UI + progress.clear_status() if successes > 0: return 0