Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion coder-sdk/devurl.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type CreateDevURLReq struct {
Scheme string `json:"scheme"`
}

// CreateDevURL inserts a new devurl for the authenticated user.
// CreateDevURL inserts a new dev URL for the authenticated user.
func (c *DefaultClient) CreateDevURL(ctx context.Context, envID string, req CreateDevURLReq) error {
return c.requestBody(ctx, http.MethodPost, "/api/v0/environments/"+envID+"/devurls", req, nil)
}
Expand Down
2 changes: 1 addition & 1 deletion docs/coder_urls.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Interact with environment DevURLs
### SEE ALSO

* [coder](coder.md) - coder provides a CLI for working with an existing Coder installation
* [coder urls create](coder_urls_create.md) - Create a new devurl for an environment
* [coder urls create](coder_urls_create.md) - Create a new dev URL for a workspace
* [coder urls ls](coder_urls_ls.md) - List all DevURLs for an environment
* [coder urls rm](coder_urls_rm.md) - Remove a dev url

10 changes: 8 additions & 2 deletions docs/coder_urls_create.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
## coder urls create

Create a new devurl for an environment
Create a new dev URL for a workspace

```
coder urls create [env_name] [port] [flags]
coder urls create [workspace_name] [port] [flags]
```

### Examples

```
coder urls create my-workspace 8080 --name my-dev-url
```

### Options
Expand Down
8 changes: 3 additions & 5 deletions internal/cmd/urls.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ func createDevURLCmd() *cobra.Command {
scheme string
)
cmd := &cobra.Command{
Use: "create [env_name] [port]",
Short: "Create a new devurl for an environment",
Use: "create [workspace_name] [port]",
Short: "Create a new dev URL for a workspace",
Aliases: []string{"edit"},
Args: xcobra.ExactArgs(2),
// Run creates or updates a devURL
Example: `coder urls create my-workspace 8080 --name my-dev-url`,
RunE: func(cmd *cobra.Command, args []string) error {
var (
envName = args[0]
Expand Down Expand Up @@ -195,8 +195,6 @@ func createDevURLCmd() *cobra.Command {
cmd.Flags().StringVar(&access, "access", "private", "Set DevURL access to [private | org | authed | public]")
cmd.Flags().StringVar(&urlname, "name", "", "DevURL name")
cmd.Flags().StringVar(&scheme, "scheme", "http", "Server scheme (http|https)")
_ = cmd.MarkFlagRequired("name")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming this is tested to see if the empty string still being in the payload doesn't break anything

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, see PR description - you get the standard naming scheme that you get in the UI when no name is provided

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ go run ./cmd/coder/main.go urls create grey-m-built-in 3002
warning: version mismatch detected
  | Coder CLI version: unknown
  | Coder API version: 1.18.0-rc.1+321-g7c364f3ab-20210510
  | 
  | tip: download the appropriate version here: https://github.com/cdr/coder-cli/releases
success: created devurl for port 3002

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot from 2021-05-10 16-57-10


return cmd
}

Expand Down