We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parentfd3d9b7 commit5c98a7eCopy full SHA for 5c98a7e
cli/root_test.go
@@ -13,6 +13,8 @@ import (
13
"strings"
14
"testing"
15
16
+"github.com/charmbracelet/lipgloss"
17
+"github.com/muesli/termenv"
18
"github.com/stretchr/testify/assert"
19
"github.com/stretchr/testify/require"
20
@@ -33,8 +35,17 @@ var updateGoldenFiles = flag.Bool("update", false, "update .golden files")
33
35
34
36
vartimestampRegex=regexp.MustCompile(`(?i)\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(.\d+)?Z`)
37
38
+// We need to override the global color profile.
39
+//
40
+//nolint:tparallel,paralleltest
41
funcTestCommandHelp(t*testing.T) {
-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
+})
49
rootClient,replacements:=prepareTestData(t)
50
51
typetestCasestruct {
cli/testdata/coder_--help.golden
@@ -3,13 +3,13 @@ Usage: coder [global-flags] <subcommand>
3
Coder v0.0.0-devel — A tool for provisioning self-hosted development environments with Terraform.
4
- Start a Coder server:
5
6
-$ coder server
+[40m [0m[91;40m$ coder server[0m[40m [0m
7
8
- Get started by creating a template from an example:
9
10
-$ coder templates init
+[40m [0m[91;40m$ coder templates init[0m[40m [0m
11
12
-Subcommands
+[1mSubcommands[0m
config-ssh Add an SSH Host entry for your workspaces "ssh
coder.workspace"
create Create a workspace
@@ -43,7 +43,7 @@ Subcommands
users Manage users
version Show coder version
-Global Options
+[1mGlobal Options[0m
Global options are applied to all commands. They can be set using environment
variables or flags.
cli/testdata/coder_agent_--help.golden
@@ -2,7 +2,7 @@ Usage: coder agent [flags]
2
Starts the Coder workspace agent.
-Options
+[1mOptions[0m
--auth string, $CODER_AGENT_AUTH (default: token)
Specify the authentication type to use for the agent.
cli/testdata/coder_config-ssh_--help.golden
@@ -5,13 +5,13 @@ Add an SSH Host entry for your workspaces "ssh coder.workspace"
- You can use -o (or --ssh-option) so set SSH options to be used for all your
workspaces:
-$ coder config-ssh -o ForwardAgent=yes
+[40m [0m[91;40m$ coder config-ssh -o ForwardAgent=yes[0m[40m [0m
- You can use --dry-run (or -n) to see the changes that would be made:
-$ coder config-ssh --dry-run
+[40m [0m[91;40m$ coder config-ssh --dry-run[0m[40m [0m
-n, --dry-run bool, $CODER_SSH_DRY_RUN
Perform a trial run with no changes made, showing a diff at the end.
cli/testdata/coder_create_--help.golden
@@ -2,7 +2,7 @@ Usage: coder create [flags] [name]
Create a workspace
--parameter-file string, $CODER_PARAMETER_FILE
Specify a file path with parameter values.
cli/testdata/coder_delete_--help.golden
@@ -4,7 +4,7 @@ Delete a workspace
Aliases: rm
--orphan bool
Delete a workspace without deleting its resources. This can delete a
workspace in a broken state, but may also lead to unaccounted cloud
cli/testdata/coder_dotfiles_--help.golden
@@ -4,9 +4,9 @@ Personalize your workspace by applying a canonical dotfiles repository
- Check out and install a dotfiles repository without prompts:
-$ coder dotfiles --yes git@github.com:example/dotfiles.git
+[40m [0m[91;40m$ coder dotfiles --yes git@github.com:example/dotfiles.git[0m[40m [0m
--symlink-dir string, $CODER_SYMLINK_DIR
Specifies the directory for the dotfiles symlink destinations. If
empty, will use $HOME.
cli/testdata/coder_list_--help.golden
@@ -4,7 +4,7 @@ List workspaces
Aliases: ls
-a, --all bool
Specifies whether all workspaces will be listed or not.
cli/testdata/coder_login_--help.golden
@@ -2,7 +2,7 @@ Usage: coder login [flags] <url>
Authenticate with Coder deployment
--first-user-email string, $CODER_FIRST_USER_EMAIL
Specifies an email address to use if creating the first user for the
deployment.
cli/testdata/coder_logout_--help.golden
@@ -2,7 +2,7 @@ Usage: coder logout [flags]
Unauthenticate your local session
-y, --yes bool
Bypass prompts.