mirror of
https://github.com/restic/restic.git
synced 2025-10-09 12:53:26 +00:00
rewrite: Add structs for tracking metadata changes
Adds * snapshotMetadataArgs, which holds the new metadata as strings parsed from the command line * snapshotMetadata, which holds the new metadata converted to the correct types
This commit is contained in:

committed by
Michael Eischer

parent
1196c72819
commit
3026baea07
@@ -3,6 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"golang.org/x/sync/errgroup"
|
"golang.org/x/sync/errgroup"
|
||||||
@@ -46,16 +47,28 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type snapshotMetadata struct {
|
||||||
|
Hostname string
|
||||||
|
Time *time.Time
|
||||||
|
}
|
||||||
|
|
||||||
|
type SnapshotMetadataArgs struct {
|
||||||
|
Hostname string
|
||||||
|
Time string
|
||||||
|
}
|
||||||
|
|
||||||
// RewriteOptions collects all options for the rewrite command.
|
// RewriteOptions collects all options for the rewrite command.
|
||||||
type RewriteOptions struct {
|
type RewriteOptions struct {
|
||||||
Forget bool
|
Forget bool
|
||||||
DryRun bool
|
DryRun bool
|
||||||
|
Metadata *SnapshotMetadataArgs
|
||||||
|
|
||||||
restic.SnapshotFilter
|
restic.SnapshotFilter
|
||||||
excludePatternOptions
|
excludePatternOptions
|
||||||
}
|
}
|
||||||
|
|
||||||
var rewriteOptions RewriteOptions
|
var rewriteOptions RewriteOptions
|
||||||
|
var metadataOptions SnapshotMetadataArgs
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
cmdRoot.AddCommand(cmdRewrite)
|
cmdRoot.AddCommand(cmdRewrite)
|
||||||
|
Reference in New Issue
Block a user