Repository: rsteube/carapace
Pull request #772 (2023-05-03 20:53:13)

style: removed `gray`
- replaced usage with `dim`



Patch:
diff --git a/defaultActions.go b/defaultActions.go
index 66ccaf1..539f6e8 100644
--- a/defaultActions.go
+++ b/defaultActions.go
@@ -295,7 +295,6 @@ func ActionStyles(styles ...string) Action {
 				s == style.Magenta ||
 				s == style.Cyan ||
 				s == style.White ||
-				s == style.Gray ||
 				s == style.BrightBlack ||
 				s == style.BrightRed ||
 				s == style.BrightGreen ||
@@ -326,7 +325,6 @@ func ActionStyles(styles ...string) Action {
 				style.Magenta, _s(style.Magenta),
 				style.Cyan, _s(style.Cyan),
 				style.White, _s(style.White),
-				style.Gray, _s(style.Gray),
 
 				style.BrightBlack, _s(style.BrightBlack),
 				style.BrightRed, _s(style.BrightRed),
diff --git a/pkg/style/config.go b/pkg/style/config.go
index d7629c8..d5a4e3d 100644
--- a/pkg/style/config.go
+++ b/pkg/style/config.go
@@ -66,17 +66,17 @@ type carapace struct {
 
 var Carapace = carapace{
 	Value:       Default,
-	Description: Gray,
+	Description: Dim,
 	Error:       Of(Bold, Red),
-	Usage:       Gray,
+	Usage:       Dim,
 
 	KeywordAmbiguous: Yellow,
 	KeywordNegative:  Red,
 	KeywordPositive:  Green,
-	KeywordUnknown:   Gray,
+	KeywordUnknown:   Of(Dim, White),
 
 	LogLevelTrace:    Blue,
-	LogLevelDebug:    Gray,
+	LogLevelDebug:    Of(Dim, White),
 	LogLevelInfo:     Green,
 	LogLevelWarning:  Yellow,
 	LogLevelError:    Magenta,
@@ -134,7 +134,6 @@ func (c carapace) Highlight(level int) string {
 	default:
 		return Default
 	}
-
 }
 
 func init() {
diff --git a/pkg/style/style.go b/pkg/style/style.go
index 5729ed7..5210ce6 100644
--- a/pkg/style/style.go
+++ b/pkg/style/style.go
@@ -18,7 +18,6 @@ var (
 	Magenta = "magenta"
 	Cyan    = "cyan"
 	White   = "white"
-	Gray    = Of(Dim, White)
 
 	BrightBlack   = "bright-black"
 	BrightRed     = "bright-red"


Test patch:
diff --git a/carapace_test.go b/carapace_test.go
index c43fae6..28ea685 100644
--- a/carapace_test.go
+++ b/carapace_test.go
@@ -230,7 +230,7 @@ func TestComplete(t *testing.T) {
 	cmd.Flags().BoolP("a", "1", false, "")
 	cmd.Flags().BoolP("b", "2", false, "")
 
-	if s, err := complete(cmd, []string{"elvish", "_", "test", "-1"}); err != nil || s != `{"Usage":"","Messages":[],"DescriptionStyle":"dim white","Candidates":[{"Value":"-12","Display":"2","Description":"","CodeSuffix":"","Style":"default"},{"Value":"-1h","Display":"h","Description":"help for test","CodeSuffix":"","Style":"default"}]}` {
+	if s, err := complete(cmd, []string{"elvish", "_", "test", "-1"}); err != nil || s != `{"Usage":"","Messages":[],"DescriptionStyle":"dim","Candidates":[{"Value":"-12","Display":"2","Description":"","CodeSuffix":"","Style":"default"},{"Value":"-1h","Display":"h","Description":"help for test","CodeSuffix":"","Style":"default"}]}` {
 		t.Error(s)
 	}
 }
@@ -246,7 +246,7 @@ func TestCompleteOptarg(t *testing.T) {
 		"opt": ActionValuesDescribed("value", "description"),
 	})
 
-	if s, err := complete(cmd, []string{"elvish", "_", "test", "--opt="}); err != nil || s != `{"Usage":"","Messages":[],"DescriptionStyle":"dim white","Candidates":[{"Value":"--opt=value","Display":"value","Description":"description","CodeSuffix":" ","Style":"default"}]}` {
+	if s, err := complete(cmd, []string{"elvish", "_", "test", "--opt="}); err != nil || s != `{"Usage":"","Messages":[],"DescriptionStyle":"dim","Candidates":[{"Value":"--opt=value","Display":"value","Description":"description","CodeSuffix":" ","Style":"default"}]}` {
 		t.Error(s)
 	}
 }
@@ -270,7 +270,7 @@ func TestCompletePositionalWithSpace(t *testing.T) {
 		ActionValues("positional with space"),
 	)
 
-	if s, err := complete(cmd, []string{"elvish", "_", "positional "}); err != nil || s != `{"Usage":"","Messages":[],"DescriptionStyle":"dim white","Candidates":[{"Value":"positional with space","Display":"positional with space","Description":"","CodeSuffix":" ","Style":"default"}]}` {
+	if s, err := complete(cmd, []string{"elvish", "_", "positional "}); err != nil || s != `{"Usage":"","Messages":[],"DescriptionStyle":"dim","Candidates":[{"Value":"positional with space","Display":"positional with space","Description":"","CodeSuffix":" ","Style":"default"}]}` {
 		t.Error(s)
 	}
 }