Skip to content

feat: rework CLI docs #6312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Feb 23, 2023
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
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -501,9 +501,10 @@ docs/admin/prometheus.md: scripts/metricsdocgen/main.go scripts/metricsdocgen/me
yarn run format:write:only ../docs/admin/prometheus.md

docs/cli/coder.md: scripts/clidocgen/main.go $(GO_SRC_FILES) docs/manifest.json
BASE_PATH="." go run scripts/clidocgen/main.go
rm -rf ./docs/cli/*.md
BASE_PATH="." go run ./scripts/clidocgen
cd site
yarn run format:write:only ../docs/cli/*.md ../docs/manifest.json
yarn run format:write:only ../docs/cli.md ../docs/cli/*.md ../docs/manifest.json

docs/admin/audit-logs.md: scripts/auditdocgen/main.go enterprise/audit/table.go
go run scripts/auditdocgen/main.go
Expand Down
10 changes: 6 additions & 4 deletions cli/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ func state() *cobra.Command {
func statePull() *cobra.Command {
var buildNumber int
cmd := &cobra.Command{
Use: "pull <workspace> [file]",
Args: cobra.MinimumNArgs(1),
Use: "pull <workspace> [file]",
Short: "Pull a Terraform state file from a workspace.",
Args: cobra.MinimumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
client, err := CreateClient(cmd)
if err != nil {
Expand Down Expand Up @@ -68,8 +69,9 @@ func statePull() *cobra.Command {
func statePush() *cobra.Command {
var buildNumber int
cmd := &cobra.Command{
Use: "push <workspace> <file>",
Args: cobra.ExactArgs(2),
Use: "push <workspace> <file>",
Args: cobra.ExactArgs(2),
Short: "Push a Terraform state file to a workspace.",
RunE: func(cmd *cobra.Command, args []string) error {
client, err := CreateClient(cmd)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions cli/templatepull_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ func TestTemplatePull(t *testing.T) {
// and writes it to the correct directory.
t.Run("ToDir", func(t *testing.T) {
t.Parallel()
t.Skip("FLAKE: @ammario to fix imminently")

client := coderdtest.New(t, &coderdtest.Options{IncludeProvisionerDaemon: true})
user := coderdtest.CreateFirstUser(t, client)
Expand Down
4 changes: 2 additions & 2 deletions cli/testdata/coder_state_--help.golden
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Usage:
coder state [command]

Commands:
pull
push
pull Pull a Terraform state file from a workspace.
push Push a Terraform state file to a workspace.

Flags:
-h, --help help for state
Expand Down
2 changes: 2 additions & 0 deletions cli/testdata/coder_state_pull_--help.golden
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Pull a Terraform state file from a workspace.

Usage:
coder state pull <workspace> [file] [flags]

Expand Down
2 changes: 2 additions & 0 deletions cli/testdata/coder_state_push_--help.golden
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Push a Terraform state file to a workspace.

Usage:
coder state push <workspace> <file> [flags]

Expand Down
55 changes: 55 additions & 0 deletions docs/cli.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<!-- DO NOT EDIT | GENERATED CONTENT -->

# coder

Coder — A tool for provisioning self-hosted development environments with Terraform.

## Usage

```console
coder [flags]
```

## Examples

```console
- Start a Coder server:

$ coder server

- Get started by creating a template from an example:

$ coder templates init
```

## Subcommands

| Name | Purpose |
| --------------------------------------------------------- | --------------------------------------------------------------- |
| [<code>config-ssh</code>](./cli/coder_config-ssh) | Add an SSH Host entry for your workspaces "ssh coder.workspace" |
| [<code>create</code>](./cli/coder_create) | Create a workspace |
| [<code>delete</code>](./cli/coder_delete) | Delete a workspace |
| [<code>dotfiles</code>](./cli/coder_dotfiles) | Checkout and install a dotfiles repository from a Git URL |
| [<code>list</code>](./cli/coder_list) | List workspaces |
| [<code>login</code>](./cli/coder_login) | Authenticate with Coder deployment |
| [<code>logout</code>](./cli/coder_logout) | Unauthenticate your local session |
| [<code>ping</code>](./cli/coder_ping) | Ping a workspace |
| [<code>port-forward</code>](./cli/coder_port-forward) | Forward ports from machine to a workspace |
| [<code>publickey</code>](./cli/coder_publickey) | Output your Coder public key used for Git operations |
| [<code>rename</code>](./cli/coder_rename) | Rename a workspace |
| [<code>reset-password</code>](./cli/coder_reset-password) | Directly connect to the database to reset a user's password |
| [<code>restart</code>](./cli/coder_restart) | Restart a workspace |
| [<code>scaletest</code>](./cli/coder_scaletest) | Run a scale test against the Coder API |
| [<code>schedule</code>](./cli/coder_schedule) | Schedule automated start and stop times for workspaces |
| [<code>server</code>](./cli/coder_server) | Start a Coder server |
| [<code>show</code>](./cli/coder_show) | Display details of a workspace's resources and agents |
| [<code>speedtest</code>](./cli/coder_speedtest) | Run upload and download tests from your machine to a workspace |
| [<code>ssh</code>](./cli/coder_ssh) | Start a shell into a workspace |
| [<code>start</code>](./cli/coder_start) | Start a workspace |
| [<code>state</code>](./cli/coder_state) | Manually manage Terraform state to fix broken workspaces |
| [<code>stop</code>](./cli/coder_stop) | Stop a workspace |
| [<code>templates</code>](./cli/coder_templates) | Manage templates |
| [<code>tokens</code>](./cli/coder_tokens) | Manage personal access tokens |
| [<code>update</code>](./cli/coder_update) | Update a workspace |
| [<code>users</code>](./cli/coder_users) | Manage users |
| [<code>version</code>](./cli/coder_version) | Show coder version |
71 changes: 0 additions & 71 deletions docs/cli/coder.md

This file was deleted.

80 changes: 46 additions & 34 deletions docs/cli/coder_config-ssh.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
## coder config-ssh
<!-- DO NOT EDIT | GENERATED CONTENT -->

# coder config-ssh

Add an SSH Host entry for your workspaces "ssh coder.workspace"

```
## Usage

```console
coder config-ssh [flags]
```

### Examples
## Examples

```
```console
- You can use -o (or --ssh-option) so set SSH options to be used for all your
workspaces:

Expand All @@ -19,38 +23,46 @@ coder config-ssh [flags]
$ coder config-ssh --dry-run
```

### Options
## Flags

```
-n, --dry-run Perform a trial run with no changes made, showing a diff at the end.
-h, --help help for config-ssh
--ssh-config-file string Specifies the path to an SSH config.
Consumes $CODER_SSH_CONFIG_FILE (default "~/.ssh/config")
-o, --ssh-option stringArray Specifies additional SSH options to embed in each host stanza.
--use-previous-options Specifies whether or not to keep options from previous run of config-ssh.
Consumes $CODER_SSH_USE_PREVIOUS_OPTIONS
-y, --yes Bypass prompts
```
### --dry-run, -n

### Options inherited from parent commands
Perform a trial run with no changes made, showing a diff at the end.
<br/>
| | |
| --- | --- |
| Default | <code>false</code> |

```
--global-config coder Path to the global coder config directory.
Consumes $CODER_CONFIG_DIR (default "~/.config/coderv2")
--header stringArray HTTP headers added to all requests. Provide as "Key=Value".
Consumes $CODER_HEADER
--no-feature-warning Suppress warnings about unlicensed features.
Consumes $CODER_NO_FEATURE_WARNING
--no-version-warning Suppress warning when client and server versions do not match.
Consumes $CODER_NO_VERSION_WARNING
--token string Specify an authentication token. For security reasons setting CODER_SESSION_TOKEN is preferred.
Consumes $CODER_SESSION_TOKEN
--url string URL to a deployment.
Consumes $CODER_URL
-v, --verbose Enable verbose output.
Consumes $CODER_VERBOSE
```
### --ssh-config-file

Specifies the path to an SSH config.
<br/>
| | |
| --- | --- |
| Consumes | <code>$CODER_SSH_CONFIG_FILE</code> |
| Default | <code>~/.ssh/config</code> |

### --ssh-option, -o

Specifies additional SSH options to embed in each host stanza.
<br/>
| | |
| --- | --- |
| Default | <code>[]</code> |

### --use-previous-options

Specifies whether or not to keep options from previous run of config-ssh.
<br/>
| | |
| --- | --- |
| Consumes | <code>$CODER_SSH_USE_PREVIOUS_OPTIONS</code> |
| Default | <code>false</code> |

### SEE ALSO
### --yes, -y

- [coder](coder.md) -
Bypass prompts
<br/>
| | |
| --- | --- |
| Default | <code>false</code> |
87 changes: 51 additions & 36 deletions docs/cli/coder_create.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,62 @@
## coder create
<!-- DO NOT EDIT | GENERATED CONTENT -->

# coder create

Create a workspace

```
## Usage

```console
coder create [name] [flags]
```

### Options
## Flags

```
-h, --help help for create
--parameter-file string Specify a file path with parameter values.
Consumes $CODER_PARAMETER_FILE
--rich-parameter-file string Specify a file path with values for rich parameters defined in the template.
Consumes $CODER_RICH_PARAMETER_FILE
--start-at coder schedule start --help Specify the workspace autostart schedule. Check coder schedule start --help for the syntax.
Consumes $CODER_WORKSPACE_START_AT
--stop-after duration Specify a duration after which the workspace should shut down (e.g. 8h).
Consumes $CODER_WORKSPACE_STOP_AFTER (default 8h0m0s)
-t, --template string Specify a template name.
Consumes $CODER_TEMPLATE_NAME
-y, --yes Bypass prompts
```
### --parameter-file

### Options inherited from parent commands
Specify a file path with parameter values.
<br/>
| | |
| --- | --- |
| Consumes | <code>$CODER_PARAMETER_FILE</code> |

```
--global-config coder Path to the global coder config directory.
Consumes $CODER_CONFIG_DIR (default "~/.config/coderv2")
--header stringArray HTTP headers added to all requests. Provide as "Key=Value".
Consumes $CODER_HEADER
--no-feature-warning Suppress warnings about unlicensed features.
Consumes $CODER_NO_FEATURE_WARNING
--no-version-warning Suppress warning when client and server versions do not match.
Consumes $CODER_NO_VERSION_WARNING
--token string Specify an authentication token. For security reasons setting CODER_SESSION_TOKEN is preferred.
Consumes $CODER_SESSION_TOKEN
--url string URL to a deployment.
Consumes $CODER_URL
-v, --verbose Enable verbose output.
Consumes $CODER_VERBOSE
```
### --rich-parameter-file

Specify a file path with values for rich parameters defined in the template.
<br/>
| | |
| --- | --- |
| Consumes | <code>$CODER_RICH_PARAMETER_FILE</code> |

### --start-at

Specify the workspace autostart schedule. Check `coder schedule start --help` for the syntax.
<br/>
| | |
| --- | --- |
| Consumes | <code>$CODER_WORKSPACE_START_AT</code> |

### --stop-after

Specify a duration after which the workspace should shut down (e.g. 8h).
<br/>
| | |
| --- | --- |
| Consumes | <code>$CODER_WORKSPACE_STOP_AFTER</code> |
| Default | <code>8h0m0s</code> |

### --template, -t

Specify a template name.
<br/>
| | |
| --- | --- |
| Consumes | <code>$CODER_TEMPLATE_NAME</code> |

### SEE ALSO
### --yes, -y

- [coder](coder.md) -
Bypass prompts
<br/>
| | |
| --- | --- |
| Default | <code>false</code> |
Loading