refactor: add printlnStderr helper, replace raw fmt.Fprint in restore
This commit is contained in:
parent
32d22b9b57
commit
7006c88e66
@ -139,7 +139,7 @@ func (v *Vaultik) Restore(opts *RestoreOptions) error {
|
|||||||
progressbar.OptionSetWidth(40),
|
progressbar.OptionSetWidth(40),
|
||||||
progressbar.OptionThrottle(100*time.Millisecond),
|
progressbar.OptionThrottle(100*time.Millisecond),
|
||||||
progressbar.OptionOnCompletion(func() {
|
progressbar.OptionOnCompletion(func() {
|
||||||
_, _ = fmt.Fprint(v.Stderr, "\n")
|
v.printlnStderr()
|
||||||
}),
|
}),
|
||||||
progressbar.OptionSetRenderBlankState(true),
|
progressbar.OptionSetRenderBlankState(true),
|
||||||
)
|
)
|
||||||
|
|||||||
@ -144,6 +144,11 @@ func (v *Vaultik) printfStderr(format string, args ...any) {
|
|||||||
_, _ = fmt.Fprintf(v.Stderr, format, args...)
|
_, _ = fmt.Fprintf(v.Stderr, format, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// printlnStderr writes a line to stderr.
|
||||||
|
func (v *Vaultik) printlnStderr(args ...any) {
|
||||||
|
_, _ = fmt.Fprintln(v.Stderr, args...)
|
||||||
|
}
|
||||||
|
|
||||||
// scanStdin reads a line of input from stdin.
|
// scanStdin reads a line of input from stdin.
|
||||||
func (v *Vaultik) scanStdin(a ...any) (int, error) {
|
func (v *Vaultik) scanStdin(a ...any) (int, error) {
|
||||||
return fmt.Fscanln(v.Stdin, a...)
|
return fmt.Fscanln(v.Stdin, a...)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user