diff --git a/cmd/incus/operation.go b/cmd/incus/operation.go index 75eaddca2e0..dd7238830e6 100644 --- a/cmd/incus/operation.go +++ b/cmd/incus/operation.go @@ -96,6 +96,7 @@ type cmdOperationList struct { operation *cmdOperation flagFormat string + flagColumns string flagAllProjects bool } @@ -105,15 +106,39 @@ func (c *cmdOperationList) Command() *cobra.Command { cmd.Aliases = []string{"ls"} cmd.Short = i18n.G("List background operations") cmd.Long = cli.FormatSection(i18n.G("Description"), i18n.G( - `List background operations`)) + `List background operations + +Default column layout: itdscCl + +== Columns == +The -c option takes a comma separated list of arguments that control +which instance attributes to output when displaying in table or csv +format. + +Column arguments are either pre-defined shorthand chars (see below), +or (extended) config keys. + +Commas between consecutive shorthand chars are optional. + +Pre-defined column shorthand chars: + i - iD + t - type + d - description + s - state + c - cancelable + C - Created + l - location`)) cmd.Flags().StringVarP(&c.flagFormat, "format", "f", "table", i18n.G("Format (csv|json|table|yaml|compact)")+"``") cmd.Flags().BoolVar(&c.flagAllProjects, "all-projects", false, i18n.G("List operations from all projects")+"``") + cmd.Flags().StringVarP(&c.flagColumns, "columns", "c", defaultOperationColumns, i18n.G("Columns")+"``") cmd.RunE = c.Run return cmd } +const defaultOperationColumns = "itdscCl" + func (c *cmdOperationList) Run(cmd *cobra.Command, args []string) error { // Quick checks. exit, err := c.global.CheckArgs(cmd, args, 0, 1)