mirror of
https://github.com/kopia/kopia.git
synced 2025-12-23 22:57:50 -05:00
also upgraded github.com/klauspost/reedsolomon to latest non-retracted version go mod tidy
33 lines
844 B
Go
33 lines
844 B
Go
package cli
|
|
|
|
import (
|
|
"github.com/alecthomas/kingpin/v2"
|
|
|
|
"github.com/kopia/kopia/repo/content"
|
|
"github.com/kopia/kopia/repo/content/index"
|
|
)
|
|
|
|
type contentRangeFlags struct {
|
|
contentIDPrefix string
|
|
contentIDNonPrefixed bool
|
|
contentIDPrefixed bool
|
|
}
|
|
|
|
func (c *contentRangeFlags) setup(cmd *kingpin.CmdClause) {
|
|
cmd.Flag("prefix", "Content ID prefix").StringVar(&c.contentIDPrefix)
|
|
cmd.Flag("prefixed", "Apply to content IDs with (any) prefix").BoolVar(&c.contentIDPrefixed)
|
|
cmd.Flag("non-prefixed", "Apply to content IDs without prefix").BoolVar(&c.contentIDNonPrefixed)
|
|
}
|
|
|
|
func (c *contentRangeFlags) contentIDRange() content.IDRange {
|
|
if c.contentIDPrefixed {
|
|
return index.AllPrefixedIDs
|
|
}
|
|
|
|
if c.contentIDNonPrefixed {
|
|
return index.AllNonPrefixedIDs
|
|
}
|
|
|
|
return index.PrefixRange(content.IDPrefix(c.contentIDPrefix))
|
|
}
|