diff --git a/go.mod b/go.mod index ec5266b048b..8721f684318 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,7 @@ require ( github.com/cloudfoundry/bosh-cli v6.4.1+incompatible github.com/cyphar/filepath-securejoin v0.2.4 github.com/docker/distribution v2.8.3+incompatible - github.com/fatih/color v1.15.0 + github.com/fatih/color v1.16.0 github.com/google/go-querystring v1.1.0 github.com/jessevdk/go-flags v1.5.0 github.com/kr/pty v1.1.8 @@ -68,7 +68,7 @@ require ( github.com/imdario/mergo v0.3.6 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/kr/text v0.2.0 // indirect - github.com/mattn/go-isatty v0.0.17 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/nxadm/tail v1.4.8 // indirect diff --git a/go.sum b/go.sum index 6dc8618c749..f9bd008ea26 100644 --- a/go.sum +++ b/go.sum @@ -69,8 +69,8 @@ github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4Kfc github.com/drewolson/testflight v1.0.0/go.mod h1:t9oKuuEohRGLb80SWX+uxJHuhX98B7HnojqtW+Ryq30= github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= -github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= -github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= +github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= +github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= @@ -167,8 +167,8 @@ github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJ github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= -github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/maxbrunsfeld/counterfeiter/v6 v6.2.2/go.mod h1:eD9eIE7cdwcMi9rYluz88Jz2VyhSmden33/aXg4oVIY= @@ -325,6 +325,7 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= diff --git a/util/ui/table_test.go b/util/ui/table_test.go index cb700236d23..3156f797d86 100644 --- a/util/ui/table_test.go +++ b/util/ui/table_test.go @@ -75,9 +75,9 @@ var _ = Describe("Table", func() { {"#0", "data1", "data2", "data3"}, }, 2) - Expect(out).To(Say(" \x1b\\[1mheader1\x1b\\[0m")) // Makes sure empty values are not bolded - Expect(out).To(Say("\x1b\\[1mheader2\x1b\\[0m")) - Expect(out).To(Say("\x1b\\[1mheader3\x1b\\[0m")) + Expect(out).To(Say(" \u001B\\[1mheader1\u001B\\[22m")) // Makes sure empty values are not bolded + Expect(out).To(Say("\u001B\\[1mheader2\u001B\\[22m")) + Expect(out).To(Say("\u001B\\[1mheader3\u001B\\[22m")) Expect(out).To(Say("#0 data1 data2 data3")) }) }) diff --git a/util/ui/ui_for_app_test.go b/util/ui/ui_for_app_test.go index daf7f7ed2cc..f6805659a8d 100644 --- a/util/ui/ui_for_app_test.go +++ b/util/ui/ui_for_app_test.go @@ -39,10 +39,10 @@ var _ = Describe("UI", func() { {"#2", "crashed", "val1", "val2"}, }) - Expect(ui.Out).To(Say("\x1b\\[1mheader1\x1b\\[0m\\s+\x1b\\[1mheader2\x1b\\[0m\\s+\x1b\\[1mheader3\x1b\\[0m")) // Makes sure empty values are not bolded + Expect(ui.Out).To(Say("\u001B\\[1mheader1\u001B\\[22m\\s+\u001B\\[1mheader2\u001B\\[22m\\s+\u001B\\[1mheader3\u001B\\[22m")) // Makes sure empty values are not bolded Expect(ui.Out).To(Say(`#0\s+starting\s+val1\s+val2`)) - Expect(ui.Out).To(Say("#1\\s+\x1b\\[31;1mdown\x1b\\[0m\\s+val1\\s+val2")) - Expect(ui.Out).To(Say("#2\\s+\x1b\\[31;1mcrashed\x1b\\[0m\\s+val1\\s+val2")) + Expect(ui.Out).To(Say("#1\\s+\u001B\\[31;1mdown\u001B\\[0;22m\\s+val1\\s+val2")) + Expect(ui.Out).To(Say("#2\\s+\u001B\\[31;1mcrashed\u001B\\[0;22m\\s+val1\\s+val2")) }) }) @@ -65,10 +65,10 @@ var _ = Describe("UI", func() { {"#2", ui.TranslateText("crashed"), "val1", "val2"}, }) - Expect(ui.Out).To(Say("\x1b\\[1mheader1\x1b\\[0m\\s+\x1b\\[1mheader2\x1b\\[0m\\s+\x1b\\[1mheader3\x1b\\[0m")) // Makes sure empty values are not bolded + Expect(ui.Out).To(Say("\u001B\\[1mheader1\u001B\\[22m\\s+\u001B\\[1mheader2\u001B\\[22m\\s+\u001B\\[1mheader3\u001B\\[22m")) // Makes sure empty values are not bolded Expect(ui.Out).To(Say(`#0\s+%s\s+val1\s+val2`, ui.TranslateText("starting"))) - Expect(ui.Out).To(Say("#1\\s+\x1b\\[31;1m%s\x1b\\[0m\\s+val1\\s+val2", ui.TranslateText("down"))) - Expect(ui.Out).To(Say("#2\\s+\x1b\\[31;1m%s\x1b\\[0m\\s+val1\\s+val2", ui.TranslateText("crashed"))) + Expect(ui.Out).To(Say("#1\\s+\u001B\\[31;1m%s\u001B\\[0;22m\\s+val1\\s+val2", ui.TranslateText("down"))) + Expect(ui.Out).To(Say("#2\\s+\u001B\\[31;1m%s\u001B\\[0;22m\\s+val1\\s+val2", ui.TranslateText("crashed"))) }) }) }) @@ -144,8 +144,8 @@ var _ = Describe("UI", func() { It("displays a table with requested state and instances in red", func() { Expect(ui.Out).To(Say("name: dora\n")) - Expect(ui.Out).To(Say("requested state: \x1b\\[31;1mrunning\x1b\\[0m\n")) - Expect(ui.Out).To(Say("instances: \x1b\\[31;1m0/1\x1b\\[0m\n")) + Expect(ui.Out).To(Say("requested state: \u001B\\[31;1mrunning\u001B\\[0;22m\n")) + Expect(ui.Out).To(Say("instances: \u001B\\[31;1m0/1\u001B\\[0;22m\n")) }) }) @@ -168,8 +168,8 @@ var _ = Describe("UI", func() { It("displays a table with requested state and instances in red", func() { Expect(ui.Out).To(Say("name: dora\n")) - Expect(ui.Out).To(Say("requested state: \x1b\\[31;1m%s\x1b\\[0m\n", ui.TranslateText("running"))) - Expect(ui.Out).To(Say("instances: \x1b\\[31;1m0/1\x1b\\[0m\n")) + Expect(ui.Out).To(Say("requested state: \u001B\\[31;1m%s\u001B\\[0;22m\n", ui.TranslateText("running"))) + Expect(ui.Out).To(Say("instances: \u001B\\[31;1m0/1\u001B\\[0;22m\n")) }) }) }) diff --git a/util/ui/ui_test.go b/util/ui/ui_test.go index 1f8110b6735..06d13e1eef1 100644 --- a/util/ui/ui_test.go +++ b/util/ui/ui_test.go @@ -95,7 +95,7 @@ var _ = Describe("UI", func() { It("displays the error to ui.Err and displays FAILED in bold red to ui.Out", func() { Expect(ui.Err).To(Say("I am an error\n")) - Expect(out).To(Say("\x1b\\[31;1mFAILED\x1b\\[0m\n")) + Expect(out).To(Say("\u001B\\[31;1mFAILED\u001B\\[0;22m\n")) }) When("the locale is not set to english", func() { @@ -110,7 +110,7 @@ var _ = Describe("UI", func() { It("displays the error text to ui.Err and displays FAILED in bold red to ui.Out", func() { ui.DisplayError(errors.New("I am a BANANA!")) Expect(ui.Err).To(Say("I am a BANANA!\n")) - Expect(out).To(Say("\x1b\\[31;1mFAILED\x1b\\[0m\n")) + Expect(out).To(Say("\u001B\\[31;1mFAILED\u001B\\[0;22m\n")) }) }) }) @@ -118,7 +118,7 @@ var _ = Describe("UI", func() { Describe("DisplayHeader", func() { It("displays the header colorized and bolded to ui.Out", func() { ui.DisplayHeader("some-header") - Expect(out).To(Say("\x1b\\[1msome-header\x1b\\[0m")) + Expect(out).To(Say("\u001B\\[1msome-header\u001B\\[22m")) }) When("the locale is not set to English", func() { @@ -134,7 +134,7 @@ var _ = Describe("UI", func() { It("displays the translated header colorized and bolded to ui.Out", func() { ui.DisplayHeader("FEATURE FLAGS") - Expect(out).To(Say("\x1b\\[1mINDICATEURS DE FONCTION\x1b\\[0m")) + Expect(out).To(Say("\u001B\\[1mINDICATEURS DE FONCTION\u001B\\[22m")) }) }) }) @@ -149,7 +149,7 @@ var _ = Describe("UI", func() { Describe("DisplayOK", func() { It("displays 'OK' in green and bold", func() { ui.DisplayOK() - Expect(out).To(Say("\x1b\\[32;1mOK\x1b\\[0m")) + Expect(out).To(Say("\u001B\\[32;1mOK\u001B\\[0;22m")) }) }) @@ -269,7 +269,7 @@ var _ = Describe("UI", func() { map[string]interface{}{ "SomeMapValue": "map-value", }) - Expect(out).To(Say("template with \x1b\\[1mmap-value\x1b\\[0m")) + Expect(out).To(Say("template with \u001B\\[1mmap-value\u001B\\[22m")) }) }) @@ -283,7 +283,7 @@ var _ = Describe("UI", func() { map[string]interface{}{ "SomeOtherMapValue": "other-map-value", }) - Expect(out).To(Say("template with \x1b\\[1mmap-value\x1b\\[0m and ")) + Expect(out).To(Say("template with \u001B\\[1mmap-value\u001B\\[22m and ")) }) }) @@ -304,7 +304,7 @@ var _ = Describe("UI", func() { map[string]interface{}{ "AppName": "some-app-name", }) - Expect(out).To(Say("L'application \x1b\\[1msome-app-name\x1b\\[0m n'existe pas.\n")) + Expect(out).To(Say("L'application \u001B\\[1msome-app-name\u001B\\[22m n'existe pas.\n")) }) }) }) @@ -322,7 +322,7 @@ var _ = Describe("UI", func() { map[string]interface{}{ "SomeMapValue": "map-value", }) - Expect(out).To(Say("template with \x1b\\[36;1mmap-value\x1b\\[0m")) + Expect(out).To(Say("template with \u001B\\[36;1mmap-value\u001B\\[0;22m")) }) }) @@ -336,7 +336,7 @@ var _ = Describe("UI", func() { map[string]interface{}{ "SomeOtherMapValue": "other-map-value", }) - Expect(out).To(Say("template with \x1b\\[36;1mmap-value\x1b\\[0m and ")) + Expect(out).To(Say("template with \u001B\\[36;1mmap-value\u001B\\[0;22m and ")) }) }) @@ -357,7 +357,7 @@ var _ = Describe("UI", func() { map[string]interface{}{ "AppName": "some-app-name", }) - Expect(out).To(Say("L'application \x1b\\[36;1msome-app-name\x1b\\[0m n'existe pas.\n")) + Expect(out).To(Say("L'application \u001B\\[36;1msome-app-name\u001B\\[0;22m n'existe pas.\n")) }) }) }) @@ -365,11 +365,11 @@ var _ = Describe("UI", func() { Describe("DisplayDiffAddition", func() { It("displays a green indented line with a +", func() { ui.DisplayDiffAddition("added", 3, false) - Expect(out).To(Say(`\x1b\[32m\+ added\x1b\[0m`)) + Expect(out).To(Say("\u001B\\[32m\\+\\s+added\u001B\\[0m")) }) It("displays a hyphen when the addHyphen is true", func() { ui.DisplayDiffAddition("added", 3, true) - Expect(out).To(Say(`\x1b\[32m\+ - added\x1b\[0m`)) + Expect(out).To(Say("\u001B\\[32m\\+\\s+\\- added\u001B\\[0m")) }) }) @@ -377,11 +377,11 @@ var _ = Describe("UI", func() { Describe("DisplayDiffRemoval", func() { It("displays a red indented line with a -", func() { ui.DisplayDiffRemoval("removed", 3, false) - Expect(out).To(Say(`\x1b\[31m\- removed\x1b\[0m`)) + Expect(out).To(Say("\u001B\\[31m\\-\\s+removed\u001B\\[0m")) }) It("displays a a hyphen when addHyphen is true", func() { ui.DisplayDiffRemoval("removed", 3, true) - Expect(out).To(Say(`\x1b\[31m\- - removed\x1b\[0m`)) + Expect(out).To(Say("\u001B\\[31m\\-\\s+\\- removed\u001B\\[0m")) }) })