Skip to content

Commit

Permalink
add progress to batch operation
Browse files Browse the repository at this point in the history
  • Loading branch information
ysmood committed Jan 11, 2024
1 parent e50a36a commit e23da27
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 10 additions & 4 deletions batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,23 +184,27 @@ func (b *Batch) Encrypt() error {
}

eg.Go(func() error {
out := filepath.Join(b.OutDir, p+WHISPER_FILE_EXT)
input := getInput(filepath.Join(b.root, p), "")
output := getOutput(out)
outPath := filepath.Join(b.OutDir, p+WHISPER_FILE_EXT)
inPath := filepath.Join(b.root, p)
input := getInput(inPath, "")
output := getOutput(outPath)

conf := whisper.Config{
GzipLevel: 9,
Public: getPublicKeys(members),
}

same, err := b.sameRecipients(conf, out)
same, err := b.sameRecipients(conf, outPath)
if err != nil {
return err
}
if same {
fmt.Fprintf(os.Stderr, "[skip] recipients not changed: %s\n", inPath)
return nil
}

fmt.Fprintf(os.Stdout, "[encrypted] %s -> %s\n", inPath, outPath)

return run(conf, input, output)
})
}
Expand Down Expand Up @@ -254,6 +258,8 @@ func (b *Batch) Decrypt(privateKeyPath string) error {
return nil
}

fmt.Fprintf(os.Stdout, "[decrypted] %s -> %s\n", inPath, outPath)

return err
})
}
Expand Down
2 changes: 1 addition & 1 deletion lib/whisper.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

const (
APIVersion = "v0.8.6"
APIVersion = "v0.8.7"
WireFormatVersion = byte(8)
)

Expand Down

0 comments on commit e23da27

Please sign in to comment.