mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat(cli): add ability to create tasks for other users (#20012)
This commit is contained in:
+10
-1
@@ -17,6 +17,7 @@ func (r *RootCmd) taskCreate() *serpent.Command {
|
||||
var (
|
||||
orgContext = NewOrganizationContext()
|
||||
|
||||
ownerArg string
|
||||
taskName string
|
||||
templateName string
|
||||
templateVersionName string
|
||||
@@ -40,6 +41,14 @@ func (r *RootCmd) taskCreate() *serpent.Command {
|
||||
Required: false,
|
||||
Default: "",
|
||||
},
|
||||
{
|
||||
Name: "owner",
|
||||
Flag: "owner",
|
||||
Description: "Specify the owner of the task. Defaults to the current user.",
|
||||
Value: serpent.StringOf(&ownerArg),
|
||||
Required: false,
|
||||
Default: codersdk.Me,
|
||||
},
|
||||
{
|
||||
Name: "template",
|
||||
Flag: "template",
|
||||
@@ -177,7 +186,7 @@ func (r *RootCmd) taskCreate() *serpent.Command {
|
||||
templateVersionPresetID = preset.ID
|
||||
}
|
||||
|
||||
task, err := expClient.CreateTask(ctx, codersdk.Me, codersdk.CreateTaskRequest{
|
||||
task, err := expClient.CreateTask(ctx, ownerArg, codersdk.CreateTaskRequest{
|
||||
Name: taskName,
|
||||
TemplateVersionID: templateVersionID,
|
||||
TemplateVersionPresetID: templateVersionPresetID,
|
||||
|
||||
Reference in New Issue
Block a user