Skip to content

Commit 5c98a7e

Browse files
committed
Fixup color
1 parent fd3d9b7 commit 5c98a7e

File tree

57 files changed

+105
-94
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+105
-94
lines changed

cli/root_test.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import (
1313
"strings"
1414
"testing"
1515

16+
"github.com/charmbracelet/lipgloss"
17+
"github.com/muesli/termenv"
1618
"github.com/stretchr/testify/assert"
1719
"github.com/stretchr/testify/require"
1820

@@ -33,8 +35,17 @@ var updateGoldenFiles = flag.Bool("update", false, "update .golden files")
3335

3436
var timestampRegex = regexp.MustCompile(`(?i)\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(.\d+)?Z`)
3537

38+
// We need to override the global color profile.
39+
//
40+
//nolint:tparallel,paralleltest
3641
func TestCommandHelp(t *testing.T) {
37-
t.Parallel()
42+
ogColorProfile := lipgloss.ColorProfile()
43+
// ANSI256 escape codes are far easier for humans to parse in a diff,
44+
// but TrueColor is probably more popular with modern terminals.
45+
lipgloss.SetColorProfile(termenv.ANSI)
46+
t.Cleanup(func() {
47+
lipgloss.SetColorProfile(ogColorProfile)
48+
})
3849
rootClient, replacements := prepareTestData(t)
3950

4051
type testCase struct {

cli/testdata/coder_--help.golden

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ Usage: coder [global-flags] <subcommand>
33
Coder v0.0.0-devel — A tool for provisioning self-hosted development environments with Terraform.
44
- Start a Coder server:
55

6-
$ coder server
6+
 $ coder server 
77

88
- Get started by creating a template from an example:
99

10-
$ coder templates init
10+
 $ coder templates init 
1111

12-
Subcommands
12+
Subcommands
1313
config-ssh Add an SSH Host entry for your workspaces "ssh
1414
coder.workspace"
1515
create Create a workspace
@@ -43,7 +43,7 @@ Subcommands
4343
users Manage users
4444
version Show coder version
4545

46-
Global Options
46+
Global Options
4747
Global options are applied to all commands. They can be set using environment
4848
variables or flags.
4949

cli/testdata/coder_agent_--help.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Usage: coder agent [flags]
22

33
Starts the Coder workspace agent.
44

5-
Options
5+
Options
66
--auth string, $CODER_AGENT_AUTH (default: token)
77
Specify the authentication type to use for the agent.
88

cli/testdata/coder_config-ssh_--help.golden

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ Add an SSH Host entry for your workspaces "ssh coder.workspace"
55
- You can use -o (or --ssh-option) so set SSH options to be used for all your
66
workspaces:
77

8-
$ coder config-ssh -o ForwardAgent=yes
8+
 $ coder config-ssh -o ForwardAgent=yes 
99

1010
- You can use --dry-run (or -n) to see the changes that would be made:
1111

12-
$ coder config-ssh --dry-run
12+
 $ coder config-ssh --dry-run 
1313

14-
Options
14+
Options
1515
-n, --dry-run bool, $CODER_SSH_DRY_RUN
1616
Perform a trial run with no changes made, showing a diff at the end.
1717

cli/testdata/coder_create_--help.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Usage: coder create [flags] [name]
22

33
Create a workspace
44

5-
Options
5+
Options
66
--parameter-file string, $CODER_PARAMETER_FILE
77
Specify a file path with parameter values.
88

cli/testdata/coder_delete_--help.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Delete a workspace
44

55
Aliases: rm
66

7-
Options
7+
Options
88
--orphan bool
99
Delete a workspace without deleting its resources. This can delete a
1010
workspace in a broken state, but may also lead to unaccounted cloud

cli/testdata/coder_dotfiles_--help.golden

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ Personalize your workspace by applying a canonical dotfiles repository
44

55
- Check out and install a dotfiles repository without prompts:
66

7-
$ coder dotfiles --yes git@github.com:example/dotfiles.git
7+
 $ coder dotfiles --yes git@github.com:example/dotfiles.git 
88

9-
Options
9+
Options
1010
--symlink-dir string, $CODER_SYMLINK_DIR
1111
Specifies the directory for the dotfiles symlink destinations. If
1212
empty, will use $HOME.

cli/testdata/coder_list_--help.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ List workspaces
44

55
Aliases: ls
66

7-
Options
7+
Options
88
-a, --all bool
99
Specifies whether all workspaces will be listed or not.
1010

cli/testdata/coder_login_--help.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Usage: coder login [flags] <url>
22

33
Authenticate with Coder deployment
44

5-
Options
5+
Options
66
--first-user-email string, $CODER_FIRST_USER_EMAIL
77
Specifies an email address to use if creating the first user for the
88
deployment.

cli/testdata/coder_logout_--help.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Usage: coder logout [flags]
22

33
Unauthenticate your local session
44

5-
Options
5+
Options
66
-y, --yes bool
77
Bypass prompts.
88

cli/testdata/coder_ping_--help.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Usage: coder ping [flags] <workspace>
22

33
Ping a workspace
44

5-
Options
5+
Options
66
-n, --num int (default: 10)
77
Specifies the number of pings to perform.
88

cli/testdata/coder_port-forward_--help.golden

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,22 @@ Aliases: tunnel
77
- Port forward a single TCP port from 1234 in the workspace to port 5678 on
88
your local machine:
99

10-
$ coder port-forward <workspace> --tcp 5678:1234
10+
 $ coder port-forward <workspace> --tcp 5678:1234 
1111

1212
- Port forward a single UDP port from port 9000 to port 9000 on your local
1313
machine:
1414

15-
$ coder port-forward <workspace> --udp 9000
15+
 $ coder port-forward <workspace> --udp 9000 
1616

1717
- Port forward multiple TCP ports and a UDP port:
1818

19-
$ coder port-forward <workspace> --tcp 8080:8080 --tcp 9000:3000 --udp 5353:53
19+
 $ coder port-forward <workspace> --tcp 8080:8080 --tcp 9000:3000 --udp 5353:53 
2020

2121
- Port forward multiple ports (TCP or UDP) in condensed syntax:
2222

23-
$ coder port-forward <workspace> --tcp 8080,9000:3000,9090-9092,10000-10002:10010-10012
23+
 $ coder port-forward <workspace> --tcp 8080,9000:3000,9090-9092,10000-10002:10010-10012 
2424

25-
Options
25+
Options
2626
-p, --tcp string-array, $CODER_PORT_FORWARD_TCP
2727
Forward TCP port(s) from the workspace to the local machine.
2828

cli/testdata/coder_publickey_--help.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Output your Coder public key used for Git operations
44

55
Aliases: pubkey
66

7-
Options
7+
Options
88
--reset bool
99
Regenerate your public key. This will require updating the key on any
1010
services it's registered with.

cli/testdata/coder_rename_--help.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Usage: coder rename [flags] <workspace> <new name>
22

33
Rename a workspace
44

5-
Options
5+
Options
66
-y, --yes bool
77
Bypass prompts.
88

cli/testdata/coder_reset-password_--help.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Usage: coder reset-password [flags] <username>
22

33
Directly connect to the database to reset a user's password
44

5-
Options
5+
Options
66
--postgres-url string, $CODER_PG_CONNECTION_URL
77
URL of a PostgreSQL database to connect to.
88

cli/testdata/coder_restart_--help.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Usage: coder restart [flags] <workspace>
22

33
Restart a workspace
44

5-
Options
5+
Options
66
-y, --yes bool
77
Bypass prompts.
88

cli/testdata/coder_scaletest_--help.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Usage: coder scaletest
22

33
Run a scale test against the Coder API
44

5-
Subcommands
5+
Subcommands
66
cleanup Cleanup scaletest workspaces, then cleanup scaletest
77
users.
88
create-workspaces Creates many users, then creates a workspace for each

cli/testdata/coder_scaletest_cleanup_--help.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Cleanup scaletest workspaces, then cleanup scaletest users.
44

55
The strategy flags will apply to each stage of the cleanup process.
66

7-
Options
7+
Options
88
--cleanup-concurrency int, $CODER_SCALETEST_CLEANUP_CONCURRENCY (default: 1)
99
Number of concurrent cleanup jobs to run. 0 means unlimited.
1010

cli/testdata/coder_scaletest_create-workspaces_--help.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ workspace, and connects to the workspace over WireGuard.
66

77
It is recommended that all rate limits are disabled on the server before running this scaletest. This test generates many login events which will be rate limited against the (most likely single) IP.
88

9-
Options
9+
Options
1010
--cleanup-concurrency int, $CODER_SCALETEST_CLEANUP_CONCURRENCY (default: 1)
1111
Number of concurrent cleanup jobs to run. 0 means unlimited.
1212

cli/testdata/coder_scaletest_workspace-traffic_--help.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Usage: coder scaletest workspace-traffic [flags]
22

33
Generate traffic to scaletest workspaces through coderd
44

5-
Options
5+
Options
66
--bytes-per-tick int, $CODER_SCALETEST_WORKSPACE_TRAFFIC_BYTES_PER_TICK (default: 1024)
77
How much traffic to generate per tick.
88

cli/testdata/coder_schedule_--help.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Usage: coder schedule { show | start | stop | override } <workspace>
22

33
Schedule automated start and stop times for workspaces
44

5-
Subcommands
5+
Subcommands
66
override-stop Override the stop time of a currently running workspace
77
instance.
88
show Show workspace schedule

cli/testdata/coder_schedule_override-stop_--help.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Override the stop time of a currently running workspace instance.
66
* The new stop time must be at least 30 minutes in the future.
77
* The workspace template may restrict the maximum workspace runtime.
88

9-
$ coder schedule override-stop my-workspace 90m
9+
 $ coder schedule override-stop my-workspace 90m 
1010

1111
---
1212
Run `coder --help` for a list of global options.

cli/testdata/coder_schedule_start_--help.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Schedule format: <start-time> [day-of-week] [location].
1414

1515
- Set the workspace to start at 9:30am (in Dublin) from Monday to Friday:
1616

17-
$ coder schedule start my-workspace 9:30AM Mon-Fri Europe/Dublin
17+
 $ coder schedule start my-workspace 9:30AM Mon-Fri Europe/Dublin 
1818

1919
---
2020
Run `coder --help` for a list of global options.

cli/testdata/coder_schedule_stop_--help.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ When enabling scheduled stop, enter a duration in one of the following formats:
1515
* 2m (2 minutes)
1616
* 2 (2 minutes)
1717

18-
$ coder schedule stop my-workspace 2h30m
18+
 $ coder schedule stop my-workspace 2h30m 
1919

2020
---
2121
Run `coder --help` for a list of global options.

0 commit comments

Comments
 (0)