chore(cli): replace lipgloss with coder/pretty (#9564)

This change will improve over CLI performance and "snappiness" as well as
substantially reduce our test times. Preliminary benchmarks show
`coder server --help` times cut from 300ms to 120ms on my dogfood
instance.

The inefficiency of lipgloss disproportionately impacts our system, as all help
text for every command is generated whenever any command is invoked.

The `pretty` API could clean up a lot of the code (e.g., by replacing
complex string concatenations with Printf), but this commit is too
expansive as is so that work will be done in a follow up.
This commit is contained in:
Ammar Bandukwala
2023-09-07 16:28:22 -05:00
committed by GitHub
parent 8421f56137
commit dd97fe2bce
80 changed files with 490 additions and 330 deletions
+2 -2
View File
@@ -14,11 +14,11 @@ coder [global-flags] <subcommand>
Coder — A tool for provisioning self-hosted development environments with Terraform.
- Start a Coder server:
$ coder server
$ coder server
- Get started by creating a template from an example:
$ coder templates init
$ coder templates init
```
## Subcommands
+3 -3
View File
@@ -14,13 +14,13 @@ coder config-ssh [flags]
```console
- You can use -o (or --ssh-option) so set SSH options to be used for all your
workspaces:
workspaces:
$ coder config-ssh -o ForwardAgent=yes
$ coder config-ssh -o ForwardAgent=yes
- You can use --dry-run (or -n) to see the changes that would be made:
$ coder config-ssh --dry-run
$ coder config-ssh --dry-run
```
## Options
+1 -1
View File
@@ -15,7 +15,7 @@ coder create [flags] [name]
```console
- Create a workspace for another user (if you have permission):
$ coder create <username>/<workspace_name>
$ coder create <username>/<workspace_name>
```
## Options
+1 -1
View File
@@ -15,7 +15,7 @@ coder dotfiles [flags] <git_repo_url>
```console
- Check out and install a dotfiles repository without prompts:
$ coder dotfiles --yes git@github.com:example/dotfiles.git
$ coder dotfiles --yes git@github.com:example/dotfiles.git
```
## Options
+8 -8
View File
@@ -17,27 +17,27 @@ coder port-forward [flags] <workspace>
## Description
```console
- Port forward a single TCP port from 1234 in the workspace to port 5678 on
your local machine:
- Port forward a single TCP port from 1234 in the workspace to port 5678 on your
local machine:
$ coder port-forward <workspace> --tcp 5678:1234
$ coder port-forward <workspace> --tcp 5678:1234
- Port forward a single UDP port from port 9000 to port 9000 on your local
machine:
machine:
$ coder port-forward <workspace> --udp 9000
$ coder port-forward <workspace> --udp 9000
- Port forward multiple TCP ports and a UDP port:
$ coder port-forward <workspace> --tcp 8080:8080 --tcp 9000:3000 --udp 5353:53
$ coder port-forward <workspace> --tcp 8080:8080 --tcp 9000:3000 --udp 5353:53
- Port forward multiple ports (TCP or UDP) in condensed syntax:
$ coder port-forward <workspace> --tcp 8080,9000:3000,9090-9092,10000-10002:10010-10012
$ coder port-forward <workspace> --tcp 8080,9000:3000,9090-9092,10000-10002:10010-10012
- Port forward specifying the local address to bind to:
$ coder port-forward <workspace> --tcp 1.2.3.4:8080:8080
$ coder port-forward <workspace> --tcp 1.2.3.4:8080:8080
```
## Options
+1 -1
View File
@@ -18,5 +18,5 @@ coder schedule override-stop <workspace-name> <duration from now>
* The new stop time must be at least 30 minutes in the future.
* The workspace template may restrict the maximum workspace runtime.
$ coder schedule override-stop my-workspace 90m
$ coder schedule override-stop my-workspace 90m
```
+1 -1
View File
@@ -25,5 +25,5 @@ Schedule format: <start-time> [day-of-week] [location].
- Set the workspace to start at 9:30am (in Dublin) from Monday to Friday:
$ coder schedule start my-workspace 9:30AM Mon-Fri Europe/Dublin
$ coder schedule start my-workspace 9:30AM Mon-Fri Europe/Dublin
```
+1 -1
View File
@@ -26,5 +26,5 @@ When enabling scheduled stop, enter a duration in one of the following formats:
* 2m (2 minutes)
* 2 (2 minutes)
$ coder schedule stop my-workspace 2h30m
$ coder schedule stop my-workspace 2h30m
```
+3 -3
View File
@@ -20,15 +20,15 @@ coder templates
Templates are written in standard Terraform and describe the infrastructure for workspaces
- Create a template for developers to create workspaces:
$ coder templates create
$ coder templates create
- Make changes to your template, and plan the changes:
$ coder templates plan my-template
$ coder templates plan my-template
- Push an update to the template. Your developers can update their workspaces:
$ coder templates push my-template
$ coder templates push my-template
```
## Subcommands
+1 -1
View File
@@ -19,7 +19,7 @@ coder templates versions
```console
- List versions of a specific template:
$ coder templates versions list my-template
$ coder templates versions list my-template
```
## Subcommands
+3 -3
View File
@@ -20,15 +20,15 @@ coder tokens
Tokens are used to authenticate automated clients to Coder.
- Create a token for automation:
$ coder tokens create
$ coder tokens create
- List your tokens:
$ coder tokens ls
$ coder tokens ls
- Remove a token by ID:
$ coder tokens rm WuoWs4ZsMX
$ coder tokens rm WuoWs4ZsMX
```
## Subcommands
+1 -1
View File
@@ -17,7 +17,7 @@ coder users activate [flags] <username|user_id>
## Description
```console
$ coder users activate example_user
$ coder users activate example_user
```
## Options
+1 -1
View File
@@ -13,7 +13,7 @@ coder users show [flags] <username|user_id|'me'>
## Description
```console
$ coder users show me
$ coder users show me
```
## Options
+1 -1
View File
@@ -18,7 +18,7 @@ coder users suspend [flags] <username|user_id>
## Description
```console
$ coder users suspend example_user
$ coder users suspend example_user
```
## Options