in pkg/kepctl/commands/query.go [30:113]
func addQuery(topLevel *cobra.Command) {
qo := repo.QueryOpts{}
cmd := &cobra.Command{
Use: "query",
Short: "Query KEPs",
Long: "Query the local filesystem, and optionally GitHub PRs for KEPs",
Example: ` kepctl query --sig architecture --status provisional --include-prs`,
SilenceUsage: true,
SilenceErrors: true,
PreRunE: func(*cobra.Command, []string) error {
return qo.Validate()
},
RunE: func(*cobra.Command, []string) error {
return runQuery(&qo)
},
}
// TODO: Should these all be global args?
cmd.PersistentFlags().StringSliceVar(
&qo.Groups,
"sig",
nil,
"SIG. If not specified, KEPs from all SIGs are shown.",
)
cmd.PersistentFlags().StringSliceVar(
&qo.Status,
"status",
nil,
"Status",
)
cmd.PersistentFlags().StringSliceVar(
&qo.Stage,
"stage",
nil,
"Stage",
)
cmd.PersistentFlags().StringSliceVar(
&qo.PRRApprover,
"prr",
nil,
"Prod Readiness Approver",
)
cmd.PersistentFlags().StringSliceVar(
&qo.Approver,
"approver",
nil,
"Approver",
)
cmd.PersistentFlags().StringSliceVar(
&qo.Author,
"author",
nil,
"Author",
)
cmd.PersistentFlags().StringSliceVar(
&qo.Participant,
"participating-sig",
nil,
"Participating SIG",
)
cmd.PersistentFlags().BoolVar(
&qo.IncludePRs,
"include-prs",
false,
"Include PRs in the results",
)
cmd.PersistentFlags().StringVar(
&qo.Output,
"output",
output.DefaultFormat,
fmt.Sprintf("Output format. Can be %v", output.ValidFormats()),
)
topLevel.AddCommand(cmd)
}