df
This commit is contained in:
@@ -370,6 +370,7 @@ class Add_File(Cmdlet):
|
|||||||
use_steps = False
|
use_steps = False
|
||||||
steps_started = False
|
steps_started = False
|
||||||
step2_done = False
|
step2_done = False
|
||||||
|
step3_done = False
|
||||||
try:
|
try:
|
||||||
ui, _ = progress.ui_and_pipe_index()
|
ui, _ = progress.ui_and_pipe_index()
|
||||||
use_steps = (ui is not None) and (len(items_to_process) == 1)
|
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
|
temp_dir_to_cleanup: Optional[Path] = None
|
||||||
delete_after_item = delete_after
|
delete_after_item = delete_after
|
||||||
try:
|
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(
|
media_path, file_hash, temp_dir_to_cleanup = self._resolve_source(
|
||||||
item, path_arg, pipe_obj, config, store_instance=storage_registry
|
item, path_arg, pipe_obj, config, store_instance=storage_registry
|
||||||
)
|
)
|
||||||
@@ -548,10 +554,9 @@ class Add_File(Cmdlet):
|
|||||||
failures += 1
|
failures += 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if use_steps and (not steps_started):
|
if use_steps and steps_started and (not step2_done):
|
||||||
progress.begin_steps(3)
|
progress.step("ingesting file")
|
||||||
progress.step("resolving source")
|
step2_done = True
|
||||||
steps_started = True
|
|
||||||
|
|
||||||
# Update pipe_obj with resolved path
|
# Update pipe_obj with resolved path
|
||||||
pipe_obj.path = str(media_path)
|
pipe_obj.path = str(media_path)
|
||||||
@@ -619,10 +624,6 @@ class Add_File(Cmdlet):
|
|||||||
failures += 1
|
failures += 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if use_steps and steps_started and (not step2_done):
|
|
||||||
progress.step("writing destination")
|
|
||||||
step2_done = True
|
|
||||||
|
|
||||||
if code == 0:
|
if code == 0:
|
||||||
successes += 1
|
successes += 1
|
||||||
else:
|
else:
|
||||||
@@ -670,6 +671,10 @@ class Add_File(Cmdlet):
|
|||||||
seen: set[str] = set()
|
seen: set[str] = set()
|
||||||
hashes = [h for h in hashes if not (h in seen or seen.add(h))]
|
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(
|
refreshed_items = Add_File._try_emit_search_file_by_hashes(
|
||||||
store=str(location),
|
store=str(location),
|
||||||
hash_values=hashes,
|
hash_values=hashes,
|
||||||
@@ -704,6 +709,8 @@ class Add_File(Cmdlet):
|
|||||||
|
|
||||||
if use_steps and steps_started:
|
if use_steps and steps_started:
|
||||||
progress.step("finalized")
|
progress.step("finalized")
|
||||||
|
# Clear the status so it doesn't linger in the UI
|
||||||
|
progress.clear_status()
|
||||||
|
|
||||||
if successes > 0:
|
if successes > 0:
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
Reference in New Issue
Block a user