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