mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: return provisioners in desc order and add limit to cli (#16720)
This commit is contained in:
+15
-1
@@ -39,6 +39,7 @@ func (r *RootCmd) provisionerList() *serpent.Command {
|
||||
cliui.TableFormat([]provisionerDaemonRow{}, []string{"name", "organization", "status", "key name", "created at", "last seen at", "version", "tags"}),
|
||||
cliui.JSONFormat(),
|
||||
)
|
||||
limit int64
|
||||
)
|
||||
|
||||
cmd := &serpent.Command{
|
||||
@@ -57,7 +58,9 @@ func (r *RootCmd) provisionerList() *serpent.Command {
|
||||
return xerrors.Errorf("current organization: %w", err)
|
||||
}
|
||||
|
||||
daemons, err := client.OrganizationProvisionerDaemons(ctx, org.ID, nil)
|
||||
daemons, err := client.OrganizationProvisionerDaemons(ctx, org.ID, &codersdk.OrganizationProvisionerDaemonsOptions{
|
||||
Limit: int(limit),
|
||||
})
|
||||
if err != nil {
|
||||
return xerrors.Errorf("list provisioner daemons: %w", err)
|
||||
}
|
||||
@@ -86,6 +89,17 @@ func (r *RootCmd) provisionerList() *serpent.Command {
|
||||
},
|
||||
}
|
||||
|
||||
cmd.Options = append(cmd.Options, []serpent.Option{
|
||||
{
|
||||
Flag: "limit",
|
||||
FlagShorthand: "l",
|
||||
Env: "CODER_PROVISIONER_LIST_LIMIT",
|
||||
Description: "Limit the number of provisioners returned.",
|
||||
Default: "50",
|
||||
Value: serpent.Int64Of(&limit),
|
||||
},
|
||||
}...)
|
||||
|
||||
orgContext.AttachOptions(cmd)
|
||||
formatter.AttachOptions(&cmd.Options)
|
||||
|
||||
|
||||
@@ -14,6 +14,9 @@ OPTIONS:
|
||||
-c, --column [id|organization id|created at|last seen at|name|version|api version|tags|key name|status|current job id|current job status|current job template name|current job template icon|current job template display name|previous job id|previous job status|previous job template name|previous job template icon|previous job template display name|organization] (default: name,organization,status,key name,created at,last seen at,version,tags)
|
||||
Columns to display in table output.
|
||||
|
||||
-l, --limit int, $CODER_PROVISIONER_LIST_LIMIT (default: 50)
|
||||
Limit the number of provisioners returned.
|
||||
|
||||
-o, --output table|json (default: table)
|
||||
Output format.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user