mirror of
https://github.com/kopia/kopia.git
synced 2026-01-25 06:48:48 -05:00
33 lines
534 B
Go
33 lines
534 B
Go
package cli
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/kopia/kopia/snapshot"
|
|
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
|
)
|
|
|
|
var (
|
|
policyListCommand = policyCommands.Command("list", "List policies.").Alias("ls")
|
|
)
|
|
|
|
func init() {
|
|
policyListCommand.Action(listPolicies)
|
|
}
|
|
|
|
func listPolicies(context *kingpin.ParseContext) error {
|
|
rep := mustOpenRepository(nil)
|
|
mgr := snapshot.NewPolicyManager(rep)
|
|
|
|
policies, err := mgr.ListPolicies()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, pol := range policies {
|
|
fmt.Println(pol.Labels)
|
|
}
|
|
|
|
return nil
|
|
}
|