mirror of
https://github.com/restic/restic.git
synced 2026-03-25 23:42:44 +00:00
get rid of fmt.Print* usages
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/restic/restic/internal/errors"
|
||||
"github.com/restic/restic/internal/feature"
|
||||
"github.com/restic/restic/internal/ui/table"
|
||||
@@ -39,7 +37,7 @@ Exit status is 1 if there was any error.
|
||||
return errors.Fatal("the feature command expects no arguments")
|
||||
}
|
||||
|
||||
fmt.Printf("All Feature Flags:\n")
|
||||
globalOptions.term.Print("All Feature Flags:\n")
|
||||
flags := feature.Flag.List()
|
||||
|
||||
tab := table.New()
|
||||
|
||||
@@ -24,7 +24,7 @@ Exit status is 1 if there was any error.
|
||||
GroupID: cmdGroupAdvanced,
|
||||
DisableAutoGenTag: true,
|
||||
Run: func(_ *cobra.Command, _ []string) {
|
||||
fmt.Printf("All Extended Options:\n")
|
||||
globalOptions.term.Print("All Extended Options:")
|
||||
var maxLen int
|
||||
for _, opt := range options.List() {
|
||||
if l := len(opt.Namespace + "." + opt.Name); l > maxLen {
|
||||
@@ -32,7 +32,7 @@ Exit status is 1 if there was any error.
|
||||
}
|
||||
}
|
||||
for _, opt := range options.List() {
|
||||
fmt.Printf(" %*s %s\n", -maxLen, opt.Namespace+"."+opt.Name, opt.Text)
|
||||
globalOptions.term.Print(fmt.Sprintf(" %*s %s", -maxLen, opt.Namespace+"."+opt.Name, opt.Text))
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
@@ -299,9 +299,7 @@ func PrintSnapshotGroupHeader(stdout io.Writer, groupKeyJSON string) error {
|
||||
}
|
||||
|
||||
// Info
|
||||
if _, err := fmt.Fprintf(stdout, "snapshots"); err != nil {
|
||||
return err
|
||||
}
|
||||
header := "snapshots"
|
||||
var infoStrings []string
|
||||
if key.Hostname != "" {
|
||||
infoStrings = append(infoStrings, "host ["+key.Hostname+"]")
|
||||
@@ -313,12 +311,10 @@ func PrintSnapshotGroupHeader(stdout io.Writer, groupKeyJSON string) error {
|
||||
infoStrings = append(infoStrings, "paths ["+strings.Join(key.Paths, ", ")+"]")
|
||||
}
|
||||
if infoStrings != nil {
|
||||
if _, err := fmt.Fprintf(stdout, " for (%s)", strings.Join(infoStrings, ", ")); err != nil {
|
||||
return err
|
||||
}
|
||||
header += " for (" + strings.Join(infoStrings, ", ") + ")"
|
||||
}
|
||||
_, err = fmt.Fprintf(stdout, ":\n")
|
||||
|
||||
header += ":\n"
|
||||
_, err = stdout.Write([]byte(header))
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user