1package cmd
 2
 3import (
 4	"github.com/spf13/cobra"
 5)
 6
 7func mirrorCommand() *cobra.Command {
 8	cmd := &cobra.Command{
 9		Use:               "is-mirror REPOSITORY",
10		Short:             "Whether a repository is a mirror",
11		Args:              cobra.ExactArgs(1),
12		PersistentPreRunE: checkIfReadable,
13		RunE: func(cmd *cobra.Command, args []string) error {
14			cfg, _ := fromContext(cmd)
15			rn := args[0]
16			rr, err := cfg.Backend.Repository(rn)
17			if err != nil {
18				return err
19			}
20
21			isMirror := rr.IsMirror()
22			cmd.Println(isMirror)
23			return nil
24		},
25	}
26
27	return cmd
28}