mirror of
https://github.com/celogeek/piwigo-cli.git
synced 2025-05-25 02:02:37 +02:00
remove empty line after bar
This commit is contained in:
parent
d2a7378de1
commit
da735d87ca
@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
|
||||
@ -62,6 +63,9 @@ func (c *ImagesListCommand) Execute(args []string) error {
|
||||
rootTree := tree.New()
|
||||
|
||||
bar := progressbar.Default(1, "listing")
|
||||
progressbar.OptionOnCompletion(func() {
|
||||
os.Stderr.WriteString("\n")
|
||||
})(bar)
|
||||
for page := 0; ; page++ {
|
||||
var resp ImagesListResult
|
||||
data := &url.Values{}
|
||||
|
@ -7,7 +7,6 @@ import (
|
||||
|
||||
"github.com/celogeek/piwigo-cli/internal/piwigo"
|
||||
"github.com/celogeek/piwigo-cli/internal/piwigo/piwigotools"
|
||||
"github.com/schollz/progressbar/v3"
|
||||
)
|
||||
|
||||
type ImagesUploadCommand struct {
|
||||
@ -40,9 +39,7 @@ func (c *ImagesUploadCommand) Execute(args []string) error {
|
||||
CategoryId: c.CategoryId,
|
||||
}
|
||||
|
||||
stat := &piwigotools.FileToUploadStat{
|
||||
Progress: progressbar.DefaultBytes(1, "..."),
|
||||
}
|
||||
stat := piwigotools.NewFileToUploadStat()
|
||||
defer stat.Close()
|
||||
stat.Add()
|
||||
p.Upload(file, stat, c.NbJobs, hasVideoJS)
|
||||
|
@ -3,7 +3,6 @@ package main
|
||||
import (
|
||||
"github.com/celogeek/piwigo-cli/internal/piwigo"
|
||||
"github.com/celogeek/piwigo-cli/internal/piwigo/piwigotools"
|
||||
"github.com/schollz/progressbar/v3"
|
||||
)
|
||||
|
||||
type ImagesUploadTreeCommand struct {
|
||||
@ -24,9 +23,7 @@ func (c *ImagesUploadTreeCommand) Execute(args []string) error {
|
||||
}
|
||||
_, hasVideoJS := status.Plugins["piwigo-videojs"]
|
||||
|
||||
stat := &piwigotools.FileToUploadStat{
|
||||
Progress: progressbar.DefaultBytes(1, "..."),
|
||||
}
|
||||
stat := piwigotools.NewFileToUploadStat()
|
||||
|
||||
defer stat.Close()
|
||||
filesToCheck := make(chan *piwigotools.FileToUpload, 1000)
|
||||
|
@ -2,6 +2,7 @@ package piwigotools
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"sync"
|
||||
|
||||
"github.com/schollz/progressbar/v3"
|
||||
@ -19,6 +20,14 @@ type FileToUploadStat struct {
|
||||
mu sync.Mutex
|
||||
}
|
||||
|
||||
func NewFileToUploadStat() *FileToUploadStat {
|
||||
bar := progressbar.DefaultBytes(1, "...")
|
||||
progressbar.OptionOnCompletion(func() { os.Stderr.WriteString("\n") })(bar)
|
||||
return &FileToUploadStat{
|
||||
Progress: bar,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *FileToUploadStat) Refresh() {
|
||||
s.Progress.Describe(fmt.Sprintf(
|
||||
"%d / %d - check:%d, upload:%d, skip:%d, fail:%d",
|
||||
|
Loading…
x
Reference in New Issue
Block a user