Skip to content

Commit

Permalink
replace super bar with intermediate "Adding..." for single files
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Jan 26, 2020
1 parent 426972e commit dd34100
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions dvc/repo/add.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,9 @@ def add(repo, targets, recursive=False, no_commit=False, fname=None):

stages_list = []
num_targets = len(targets)
with Tqdm(
total=num_targets,
desc="Add",
unit="file",
leave=True,
disable=True if num_targets < 2 else None,
) as pbar:
with Tqdm(total=num_targets, desc="Add", unit="file", leave=True) as pbar:
if num_targets == 1:
pbar.bar_format = "Adding..."
for target in targets:
sub_targets = _find_all_targets(repo, target, recursive)
pbar.total += len(sub_targets) - 1
Expand Down Expand Up @@ -62,8 +58,8 @@ def add(repo, targets, recursive=False, no_commit=False, fname=None):

stages_list += stages

if pbar.disable:
pbar.write("100% Add")
if num_targets == 1:
pbar.bar_format = pbar.BAR_FMT_DEFAULT

return stages_list

Expand Down

0 comments on commit dd34100

Please sign in to comment.