Define filter argument as persistent flag in list

command
This commit is contained in:
PiMaDaum 2023-02-05 19:38:58 +01:00
parent 4e5983dc43
commit 5ee20771a8
2 changed files with 6 additions and 7 deletions

View file

@ -19,6 +19,12 @@ var listCmd = &cobra.Command{
func init() {
rootCmd.AddCommand(listCmd)
listCmd.PersistentFlags().BoolP("json", "j", false, "Output JSON")
listCmd.PersistentFlags().String("filter", "",
"Define a CEl expression as filter for any list commands. In the expression, all available columns of subcommand can be used (see -c/--column).\n"+
"See also CEl specifications under https://github.com/google/cel-spec.\n"+
"Examples:\n"+
"\t--filter '(Name == \"SomeName\" || matches(Name, \"RegExpr\")) && URI.startsWith(\"https://auth.\")'\n"+
"\t--filter 'Username == \"User\" && CreatedTimestamp > timestamp(\"2022-06-10T00:00:00.000-00:00\")'")
listCmd.AddCommand(resource.ResourceListCmd)
listCmd.AddCommand(folder.FolderListCmd)
listCmd.AddCommand(group.GroupListCmd)