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 parent0f4717e commitf05f122Copy full SHA for f05f122
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,11 +3,11 @@ 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
- [;m$ coder server[0m
+[40m [0m[91;40m$ coder server[0m[40m [0m
7
8
- Get started by creating a template from an example:
9
10
- [;m$ coder templates init[0m
+[40m [0m[91;40m$ coder templates init[0m[40m[0m
11
12
[1mSubcommands[0m
config-ssh Add an SSH Host entry for your workspaces "ssh
cli/testdata/coder_config-ssh_--help.golden
@@ -5,11 +5,11 @@ 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:
- [;m$ coder config-ssh -o ForwardAgent=yes[0m
+[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:
- [;m$ coder config-ssh --dry-run[0m
+[40m [0m[91;40m$ coder config-ssh --dry-run[0m[40m[0m
[1mOptions[0m
-n, --dry-run bool, $CODER_SSH_DRY_RUN
cli/testdata/coder_dotfiles_--help.golden
@@ -4,7 +4,7 @@ Personalize your workspace by applying a canonical dotfiles repository
- Check out and install a dotfiles repository without prompts:
- [;m$ coder dotfiles --yes git@github.com:example/dotfiles.git[0m
+[40m [0m[91;40m$ coder dotfiles --yes git@github.com:example/dotfiles.git[0m[40m[0m
--symlink-dir string, $CODER_SYMLINK_DIR
cli/testdata/coder_port-forward_--help.golden
@@ -7,20 +7,20 @@ Aliases: tunnel
- Port forward a single TCP port from 1234 in the workspace to port 5678 on
your local machine:
- [;m$ coder port-forward <workspace> --tcp 5678:1234[0m
+[40m [0m[91;40m$ coder port-forward <workspace> --tcp 5678:1234[0m[40m [0m
- Port forward a single UDP port from port 9000 to port 9000 on your local
machine:
- [;m$ coder port-forward <workspace> --udp 9000[0m
+[40m [0m[91;40m$ coder port-forward <workspace> --udp 9000[0m[40m [0m
- Port forward multiple TCP ports and a UDP port:
- [;m$ coder port-forward <workspace> --tcp 8080:8080 --tcp 9000:3000 --udp 5353:53[0m
+[40m [0m[91;40m$ coder port-forward <workspace> --tcp 8080:8080 --tcp 9000:3000 --udp 5353:53[0m[40m [0m
21
- Port forward multiple ports (TCP or UDP) in condensed syntax:
22
23
- [;m$ coder port-forward <workspace> --tcp 8080,9000:3000,9090-9092,10000-10002:10010-10012[0m
+[40m [0m[91;40m$ coder port-forward <workspace> --tcp 8080,9000:3000,9090-9092,10000-10002:10010-10012[0m[40m[0m
24
25
26
-p, --tcp string-array, $CODER_PORT_FORWARD_TCP
cli/testdata/coder_schedule_override-stop_--help.golden
@@ -6,7 +6,7 @@ Override the stop time of a currently running workspace instance.
* The new stop time must be at least 30 minutes in the future.
* The workspace template may restrict the maximum workspace runtime.
- [;m$ coder schedule override-stop my-workspace 90m[0m
+[40m [0m[91;40m$ coder schedule override-stop my-workspace 90m[0m[40m[0m
---
Run `coder --help` for a list of global options.
cli/testdata/coder_schedule_start_--help.golden
@@ -14,7 +14,7 @@ Schedule format: <start-time> [day-of-week] [location].
- Set the workspace to start at 9:30am (in Dublin) from Monday to Friday:
- [;m$ coder schedule start my-workspace 9:30AM Mon-Fri Europe/Dublin[0m
+[40m [0m[91;40m$ coder schedule start my-workspace 9:30AM Mon-Fri Europe/Dublin[0m[40m[0m
cli/testdata/coder_schedule_stop_--help.golden
@@ -15,7 +15,7 @@ When enabling scheduled stop, enter a duration in one of the following formats:
* 2m (2 minutes)
* 2 (2 minutes)
- [;m$ coder schedule stop my-workspace 2h30m[0m
+[40m [0m[91;40m$ coder schedule stop my-workspace 2h30m[0m[40m[0m
cli/testdata/coder_templates_--help.golden
@@ -7,15 +7,15 @@ Aliases: template
Templates are written in standard Terraform and describe the infrastructure for workspaces
- Create a template for developers to create workspaces:
- [;m$ coder templates create[0m
+[40m [0m[91;40m$ coder templates create[0m[40m [0m
- Make changes to your template, and plan the changes:
- [;m$ coder templates plan my-template[0m
+[40m [0m[91;40m$ coder templates plan my-template[0m[40m [0m
- Push an update to the template. Your developers can update their workspaces:
- [;m$ coder templates push my-template[0m
+[40m [0m[91;40m$ coder templates push my-template[0m[40m[0m
create Create a template from the current directory or as specified by
cli/testdata/coder_templates_versions_--help.golden
@@ -6,7 +6,7 @@ Aliases: version
- List versions of a specific template:
- [;m$ coder templates versions list my-template[0m
+[40m [0m[91;40m$ coder templates versions list my-template[0m[40m[0m
list List all the versions of the specified template