mirror of
https://github.com/kopia/kopia.git
synced 2026-01-01 19:17:56 -05:00
Both source and destination can be specified using user@host, @host or user@host:/path where destination values override the corresponding parts of the source, so both targeted and mass copying is supported. Supported combinations are: Source: Destination Behavior --------------------------------------------------- @host1 @host2 copy snapshots from all users of host1 user1@host1 @host2 copy all snapshots to user1@host2 user1@host1 user2@host2 copy all snapshots to user2@host2 user1@host1:/path1 @host2 copy to user1@host2:/path1 user1@host1:/path1 user2@host2 copy to user2@host2:/path1 user1@host1:/path1 user2@host2:/path2 copy snapshots from single path When --move is specified, the matching source snapshots are also deleted. * cli: upgraded kingpin to latest version (not tagged) This allows using `EnableFileExpansion` to disable treating arguments prefixed with "@" as file includes.
32 lines
731 B
Go
32 lines
731 B
Go
package cli
|
|
|
|
import (
|
|
"github.com/alecthomas/kingpin"
|
|
|
|
"github.com/kopia/kopia/repo/content"
|
|
)
|
|
|
|
var (
|
|
contentIDPrefix string
|
|
contentIDNonPrefixed bool
|
|
contentIDPrefixed bool
|
|
)
|
|
|
|
func setupContentIDRangeFlags(cmd *kingpin.CmdClause) {
|
|
cmd.Flag("prefix", "Content ID prefix").StringVar(&contentIDPrefix)
|
|
cmd.Flag("prefixed", "Apply to content IDs with (any) prefix").BoolVar(&contentIDPrefixed)
|
|
cmd.Flag("non-prefixed", "Apply to content IDs without prefix").BoolVar(&contentIDNonPrefixed)
|
|
}
|
|
|
|
func contentIDRange() content.IDRange {
|
|
if contentIDPrefixed {
|
|
return content.AllPrefixedIDs
|
|
}
|
|
|
|
if contentIDNonPrefixed {
|
|
return content.AllNonPrefixedIDs
|
|
}
|
|
|
|
return content.PrefixRange(content.ID(contentIDPrefix))
|
|
}
|