Skip to content

Commit

Permalink
incus/operation/list update long description to include --column flag
Browse files Browse the repository at this point in the history
Signed-off-by: HassanAlsamahi <hassanalsamahi12@gmail.com>
  • Loading branch information
HassanAlsamahi committed Aug 12, 2024
1 parent 6682675 commit c037221
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion cmd/incus/operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ type cmdOperationList struct {
operation *cmdOperation

flagFormat string
flagColumns string
flagAllProjects bool
}

Expand All @@ -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)
Expand Down

0 comments on commit c037221

Please sign in to comment.