diff --git a/pkg/cmd/config/list/list.go b/pkg/cmd/config/list/list.go index c6d45e5ff..f610de579 100644 --- a/pkg/cmd/config/list/list.go +++ b/pkg/cmd/config/list/list.go @@ -46,9 +46,6 @@ func listRun(opts *ListOptions) error { return err } - cs := opts.IO.ColorScheme() - isTTY := opts.IO.IsStdoutTTY() - var host string if opts.Hostname != "" { host = opts.Hostname @@ -59,23 +56,14 @@ func listRun(opts *ListOptions) error { } } - if isTTY { - fmt.Fprint(opts.IO.Out, cs.Grayf("Settings configured for %s\n\n", host)) - } - configOptions := config.ConfigOptions() for _, key := range configOptions { - val, err := cfg.Get(opts.Hostname, key.Key) + val, err := cfg.Get(host, key.Key) if err != nil { return err } - configLine := fmt.Sprintf("%s: %s", key.Key, val) - if isTTY && key.DefaultValue != "" && val != key.DefaultValue { - configLine = cs.Bold(configLine) - configLine += fmt.Sprintf(" (default: %s)", key.DefaultValue) - } - fmt.Fprint(opts.IO.Out, configLine, "\n") + fmt.Fprint(opts.IO.Out, fmt.Sprintf("%s=%s\n", key.Key, val)) } return nil diff --git a/pkg/cmd/config/list/list_test.go b/pkg/cmd/config/list/list_test.go index de83adfb2..14f9aba4b 100644 --- a/pkg/cmd/config/list/list_test.go +++ b/pkg/cmd/config/list/list_test.go @@ -72,13 +72,11 @@ func Test_listRun(t *testing.T) { name string input *ListOptions config config.ConfigStub - isTTY bool stdout string wantErr bool }{ { - name: "list", - isTTY: true, + name: "list", config: config.ConfigStub{ "HOST:git_protocol": "ssh", "HOST:editor": "/usr/bin/vim", @@ -88,22 +86,18 @@ func Test_listRun(t *testing.T) { "HOST:browser": "brave", }, input: &ListOptions{Hostname: "HOST"}, // ConfigStub gives empty DefaultHost - stdout: `Settings configured for HOST - -git_protocol: ssh (default: https) -editor: /usr/bin/vim -prompt: disabled (default: enabled) -pager: less -http_unix_socket: -browser: brave + stdout: `git_protocol=ssh +editor=/usr/bin/vim +prompt=disabled +pager=less +http_unix_socket= +browser=brave `, }, } for _, tt := range tests { io, _, stdout, _ := iostreams.Test() - io.SetStdoutTTY(tt.isTTY) - io.SetStdinTTY(tt.isTTY) tt.input.IO = io tt.input.Config = func() (config.Config, error) { return tt.config, nil