mirror of https://github.com/restic/restic.git
Select specific Node fields for listing
This commit is contained in:
parent
04c67d700d
commit
22475729ce
|
@ -3,7 +3,9 @@ package main
|
|||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
|
@ -68,7 +70,16 @@ type lsSnapshot struct {
|
|||
}
|
||||
|
||||
type lsNode struct {
|
||||
*restic.Node
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
Path string `json:"path"`
|
||||
UID uint32 `json:"uid"`
|
||||
GID uint32 `json:"gid"`
|
||||
Size uint64 `json:"size,omitempty"`
|
||||
Mode os.FileMode `json:"mode,omitempty"`
|
||||
ModTime time.Time `json:"mtime,omitempty"`
|
||||
AccessTime time.Time `json:"atime,omitempty"`
|
||||
ChangeTime time.Time `json:"ctime,omitempty"`
|
||||
StructType string `json:"struct_type"` // "node"
|
||||
}
|
||||
|
||||
|
@ -153,7 +164,16 @@ func runLs(opts LsOptions, gopts GlobalOptions, args []string) error {
|
|||
|
||||
printNode = func(path string, node *restic.Node) {
|
||||
enc.Encode(lsNode{
|
||||
Node: node,
|
||||
Name: node.Name,
|
||||
Type: node.Type,
|
||||
Path: path,
|
||||
UID: node.UID,
|
||||
GID: node.GID,
|
||||
Size: node.Size,
|
||||
Mode: node.Mode,
|
||||
ModTime: node.ModTime,
|
||||
AccessTime: node.AccessTime,
|
||||
ChangeTime: node.ChangeTime,
|
||||
StructType: "node",
|
||||
})
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ type Node struct {
|
|||
|
||||
Error string `json:"error,omitempty"`
|
||||
|
||||
Path string `json:"path"`
|
||||
Path string `json:"-"`
|
||||
}
|
||||
|
||||
// Nodes is a slice of nodes that can be sorted.
|
||||
|
|
Loading…
Reference in New Issue