2018-06-04 09:48:56 -04:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/genuinetools/reg/repoutils"
|
|
|
|
"github.com/urfave/cli"
|
|
|
|
)
|
|
|
|
|
|
|
|
var digestCommand = cli.Command{
|
|
|
|
Name: "digest",
|
2018-06-06 14:24:58 -04:00
|
|
|
Usage: "get the digest",
|
2018-06-04 09:48:56 -04:00
|
|
|
Action: func(c *cli.Context) error {
|
|
|
|
if len(c.Args()) < 1 {
|
|
|
|
return fmt.Errorf("pass the name of the repository")
|
|
|
|
}
|
|
|
|
|
|
|
|
repo, ref, err := repoutils.GetRepoAndRef(c.Args()[0])
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2018-06-06 14:24:58 -04:00
|
|
|
digest, err := r.Digest(repo, ref)
|
2018-06-04 09:48:56 -04:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2018-06-06 14:24:58 -04:00
|
|
|
fmt.Println(digest)
|
2018-06-04 09:48:56 -04:00
|
|
|
|
|
|
|
return nil
|
|
|
|
},
|
|
|
|
}
|