1
0
Fork 0
mirror of https://github.com/drone/drone-cli.git synced 2024-06-08 15:06:04 +02:00

add active flag to filter active repos

This commit is contained in:
Brad Rydzewski 2020-01-29 12:07:53 -08:00
parent f9fd3fe42b
commit c575af0a88

View File

@ -24,6 +24,10 @@ var repoListCmd = cli.Command{
Name: "org",
Usage: "filter by organization",
},
cli.BoolFlag{
Name: "active",
Usage: "filter active repositories only",
},
},
}
@ -43,11 +47,14 @@ func repoList(c *cli.Context) error {
return err
}
org := c.String("org")
org, active := c.String("org"), c.Bool("active")
for _, repo := range repos {
if org != "" && org != repo.Namespace {
continue
}
if !repo.Active && active {
continue
}
tmpl.Execute(os.Stdout, repo)
}
return nil