Skip to content

Commit

Permalink
Overwrite (#18)
Browse files Browse the repository at this point in the history
* Add the beginnings of an about screen & an overwrite  setting

# Conflicts:
#	pkg/ui/model.go

# Conflicts:
#	pkg/ui/model.go

* Working.

* Overwrite files on save option.

* Futz with the progress bar on save.
  • Loading branch information
g026r authored Sep 28, 2024
1 parent 539db7f commit b5d9a38
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/ui/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,13 +339,17 @@ func (m *Model) save() tea.Msg {

ctr := 0.0
tick := make(chan any)
defer close(tick)
total := float64(len(m.entries))
for _, v := range m.thumbnails {
if v.Modified {
total = total + float64(len(v.Images)) // Only increase the total if they've been modified since we don't write them out otherwise.
}
}
total = total + 1 // Add 1 for the config
// Add some extra to account for copying the files.
// This means the bar will never reach 100% since the tick channel is closed by then
// but better to pause for an extended period at 95% than at 100%
total = total + total/.95

go func() { // Run these in a goroutine to avoid having to pass around the pointer to the progress value as that would require knowing the total as well
defer close(tick)
Expand Down

0 comments on commit b5d9a38

Please sign in to comment.