mirror of
https://github.com/restic/restic.git
synced 2026-11-28 15:26:48 +00:00
More integration tests
This commit is contained in:
1 parent
9b7db4df24
commit
7c107acf0b
4 files changed
+231
-6
No files matched your search
+11
-3
@@ -3,11 +3,15 @@ package main
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
|
||||
"github.com/restic/restic/backend"
|
||||
)
|
||||
|
||||
type CmdList struct{}
|
||||
type CmdList struct {
|
||||
w io.Writer
|
||||
}
|
||||
|
||||
func init() {
|
||||
_, err := parser.AddCommand("list",
|
||||
@@ -24,6 +28,10 @@ func (cmd CmdList) Usage() string {
|
||||
}
|
||||
|
||||
func (cmd CmdList) Execute(args []string) error {
|
||||
if cmd.w == nil {
|
||||
cmd.w = os.Stdout
|
||||
}
|
||||
|
||||
if len(args) != 1 {
|
||||
return fmt.Errorf("type not specified, Usage: %s", cmd.Usage())
|
||||
}
|
||||
@@ -42,7 +50,7 @@ func (cmd CmdList) Execute(args []string) error {
|
||||
}
|
||||
|
||||
for blob := range s.Index().Each(nil) {
|
||||
fmt.Println(blob.ID)
|
||||
fmt.Fprintln(cmd.w, blob.ID)
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -61,7 +69,7 @@ func (cmd CmdList) Execute(args []string) error {
|
||||
}
|
||||
|
||||
for id := range s.List(t, nil) {
|
||||
fmt.Printf("%s\n", id)
|
||||
fmt.Fprintf(cmd.w, "%s\n", id)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Reference in new issue
Block a user