mirror of
https://github.com/celogeek/go-comic-converter.git
synced 2025-05-25 08:12:36 +02:00
simplify a bit
This commit is contained in:
parent
63f980e4cb
commit
61ee576465
@ -4,6 +4,7 @@ create a progress bar with custom settings.
|
||||
package epubprogress
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"time"
|
||||
@ -31,7 +32,10 @@ func New(o Options) epubProgress {
|
||||
}
|
||||
|
||||
if o.Json {
|
||||
return newEpubProgressJson(o)
|
||||
return &epubProgressJson{
|
||||
o: o,
|
||||
e: json.NewEncoder(os.Stdout),
|
||||
}
|
||||
}
|
||||
|
||||
fmtJob := fmt.Sprintf("%%0%dd", len(fmt.Sprint(o.TotalJob)))
|
||||
|
@ -2,7 +2,6 @@ package epubprogress
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
)
|
||||
|
||||
type epubProgressJson struct {
|
||||
@ -11,13 +10,6 @@ type epubProgressJson struct {
|
||||
current int
|
||||
}
|
||||
|
||||
func newEpubProgressJson(o Options) epubProgress {
|
||||
return &epubProgressJson{
|
||||
o: o,
|
||||
e: json.NewEncoder(os.Stdout),
|
||||
}
|
||||
}
|
||||
|
||||
func (p *epubProgressJson) Add(num int) error {
|
||||
p.current += num
|
||||
p.e.Encode(map[string]any{
|
||||
|
Loading…
x
Reference in New Issue
Block a user