Skip to content
This repository was archived by the owner on Feb 16, 2023. It is now read-only.

Commit b6d7b7e

Browse files
committed
Make in-line progression
This makes the progress of checking vaults and applying changes nicer, since it occupies only one line and it updates based on the progress.
1 parent db44062 commit b6d7b7e

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

internals/secrethub/migrate.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,9 @@ func (cmd *MigrateApplyCommand) Run() error {
496496

497497
i := 1
498498
for _, vault := range plan.vaults {
499+
if i != 1 {
500+
fmt.Fprintf(cmd.io.Output(), "\033[1A\033[K")
501+
}
499502
fmt.Fprintf(cmd.io.Output(), "[%d/%d] Checking vault: %s\n", i, len(plan.vaults), vault.Name)
500503
vaultExists, err := onepassword.ExistsVault(vault.Name)
501504
if err != nil {
@@ -602,12 +605,17 @@ func (cmd *MigrateApplyCommand) Run() error {
602605
fmt.Fprintln(cmd.io.Output())
603606
fmt.Fprintf(cmd.io.Output(), "Applying changes:\n")
604607
for i, change := range changes {
608+
if i != 0 {
609+
fmt.Fprintf(cmd.io.Output(), "\033[1A\033[K")
610+
}
605611
fmt.Fprintf(cmd.io.Output(), "[%d/%d]\n", i, len(changes))
606612
err := change.Apply()
607613
if err != nil {
608614
return err
609615
}
610616
}
617+
fmt.Fprintf(cmd.io.Output(), "\033[1A\033[K")
618+
fmt.Fprintf(cmd.io.Output(), "[%d/%d]\n", len(changes), len(changes))
611619
fmt.Fprintf(cmd.io.Output(), "Migration completed\n")
612620
return nil
613621
}

0 commit comments

Comments
 (0)