mirror of
https://github.com/genuinetools/reg.git
synced 2024-09-28 11:46:20 -04:00
main: add missing preconditions to commands (#63)
- fixed panic when a repository was not provided to: delete, manifest, download, vulns
This commit is contained in:
parent
22cbb0f2a0
commit
44f18c0104
1 changed files with 15 additions and 0 deletions
15
main.go
15
main.go
|
@ -108,6 +108,10 @@ func main() {
|
|||
Aliases: []string{"rm"},
|
||||
Usage: "delete a specific reference of a repository",
|
||||
Action: func(c *cli.Context) error {
|
||||
if len(c.Args()) < 1 {
|
||||
return fmt.Errorf("pass the name of the repository")
|
||||
}
|
||||
|
||||
repo, ref, err := utils.GetRepoAndRef(c.Args()[0])
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -173,6 +177,10 @@ func main() {
|
|||
},
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
if len(c.Args()) < 1 {
|
||||
return fmt.Errorf("pass the name of the repository")
|
||||
}
|
||||
|
||||
repo, ref, err := utils.GetRepoAndRef(c.Args()[0])
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -231,6 +239,10 @@ func main() {
|
|||
},
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
if len(c.Args()) < 1 {
|
||||
return fmt.Errorf("pass the name of the repository")
|
||||
}
|
||||
|
||||
repo, ref, err := utils.GetRepoAndRef(c.Args()[0])
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -269,6 +281,9 @@ func main() {
|
|||
if c.String("clair") == "" {
|
||||
return errors.New("clair url cannot be empty, pass --clair")
|
||||
}
|
||||
if len(c.Args()) < 1 {
|
||||
return fmt.Errorf("pass the name of the repository")
|
||||
}
|
||||
|
||||
repo, ref, err := utils.GetRepoAndRef(c.Args()[0])
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue