()
| 14 | ) |
| 15 | |
| 16 | func (r *RootCmd) taskCreate() *serpent.Command { |
| 17 | var ( |
| 18 | orgContext = NewOrganizationContext() |
| 19 | |
| 20 | ownerArg string |
| 21 | taskName string |
| 22 | templateName string |
| 23 | templateVersionName string |
| 24 | presetName string |
| 25 | stdin bool |
| 26 | quiet bool |
| 27 | ) |
| 28 | |
| 29 | cmd := &serpent.Command{ |
| 30 | Use: "create [input]", |
| 31 | Short: "Create a task", |
| 32 | Long: FormatExamples( |
| 33 | Example{ |
| 34 | Description: "Create a task with direct input", |
| 35 | Command: "coder task create \"Add authentication to the user service\"", |
| 36 | }, |
| 37 | Example{ |
| 38 | Description: "Create a task with stdin input", |
| 39 | Command: "echo \"Add authentication to the user service\" | coder task create", |
| 40 | }, |
| 41 | Example{ |
| 42 | Description: "Create a task with a specific name", |
| 43 | Command: "coder task create --name task1 \"Add authentication to the user service\"", |
| 44 | }, |
| 45 | Example{ |
| 46 | Description: "Create a task from a specific template / preset", |
| 47 | Command: "coder task create --template backend-dev --preset \"My Preset\" \"Add authentication to the user service\"", |
| 48 | }, |
| 49 | Example{ |
| 50 | Description: "Create a task for another user (requires appropriate permissions)", |
| 51 | Command: "coder task create --owner user@example.com \"Add authentication to the user service\"", |
| 52 | }, |
| 53 | ), |
| 54 | Middleware: serpent.Chain( |
| 55 | serpent.RequireRangeArgs(0, 1), |
| 56 | ), |
| 57 | Options: serpent.OptionSet{ |
| 58 | { |
| 59 | Name: "name", |
| 60 | Flag: "name", |
| 61 | Description: "Specify the name of the task. If you do not specify one, a name will be generated for you.", |
| 62 | Value: serpent.StringOf(&taskName), |
| 63 | Required: false, |
| 64 | Default: "", |
| 65 | }, |
| 66 | { |
| 67 | Name: "owner", |
| 68 | Flag: "owner", |
| 69 | Description: "Specify the owner of the task. Defaults to the current user.", |
| 70 | Value: serpent.StringOf(&ownerArg), |
| 71 | Required: false, |
| 72 | Default: codersdk.Me, |
| 73 | }, |
no test coverage detected