Repository navigation
Mark skills that need a newer CLI in skills list #8138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
402ec08
2df5cf8
aa6b7d3
fb7d076
c1365d3
b2a2be6
055acad
79c67cd
4530158
b61b62d
2906664
ddbdb00
41dfd3d
417ae32
c75c37c
fcd2902
497ff28
53c8155
4844df8
b262160
c3c22dd
6729933
3ac93e6
b10ce6a
c4a5e80
ca310ed
047b7e2
3055330
126f116
cc8f674
beeb396
fe9e87b
22df1f3
562018f
7b6f5f1
237f728
ab4e2c7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ import ( | |
| "testing" | ||
| "time" | ||
|
|
||
| "github.com/databricks/cli/internal/build" | ||
| "github.com/databricks/cli/libs/cmdio" | ||
| "github.com/databricks/cli/libs/flags" | ||
| libskills "github.com/databricks/cli/libs/skills" | ||
|
|
@@ -161,7 +162,11 @@ func renderTextScan(rules string, list []libskills.Skill) string { | |
| return withRules(rules) + "No skills found.\n" | ||
| } | ||
| list = oneLineSkills(list) | ||
| names := layoutText(rules, list, 0) | ||
| notes := make([]string, len(list)) | ||
| for i, s := range list { | ||
| notes[i] = newerCLINote(s) | ||
| } | ||
| names := layoutText(rules, list, notes, 0) | ||
| if len(names)-len(searchHint)-1 > textBudget { | ||
| return names | ||
| } | ||
|
|
@@ -170,7 +175,7 @@ func renderTextScan(rules string, list []libskills.Skill) string { | |
| maxLen = max(maxLen, len(s.Description)) | ||
| } | ||
| for w := min(maxLen, textBudget); w > 0; w-- { | ||
| if out := layoutText(rules, list, w); len(out) <= textBudget { | ||
| if out := layoutText(rules, list, notes, w); len(out) <= textBudget { | ||
| return out | ||
| } | ||
| } | ||
|
|
@@ -261,6 +266,25 @@ func TestRenderTextNoSearchHintWithoutDescriptions(t *testing.T) { | |
| assert.Equal(t, "alpha\nbeta\n"+readHint+"\n", renderText("", list)) | ||
| } | ||
|
|
||
| func TestRenderTextMarksSkillThatNeedsNewerCLI(t *testing.T) { | ||
| list := []libskills.Skill{ | ||
| {Name: "alpha", Description: "Alpha does one thing well."}, | ||
| {Name: "future", Description: "Needs a newer CLI.", MinCLIVer: "99.0.0"}, | ||
| } | ||
| assert.Equal(t, "alpha: Alpha does one thing well.\nfuture: Needs a newer CLI. (needs CLI 99.0.0 or newer)\n"+readHint+"\n", | ||
| renderText("", list)) | ||
| } | ||
|
|
||
| func TestRenderTextMarksNamesOnlyLineThatNeedsNewerCLI(t *testing.T) { | ||
| list := []libskills.Skill{{Name: "alpha"}, {Name: "future", MinCLIVer: "99.0.0"}} | ||
| assert.Equal(t, "alpha\nfuture: (needs CLI 99.0.0 or newer)\n"+readHint+"\n", renderText("", list)) | ||
| } | ||
|
|
||
| func TestRenderTextNoMarkWhenCLIIsNewEnough(t *testing.T) { | ||
| list := []libskills.Skill{{Name: "current", Description: "Current.", MinCLIVer: build.GetInfo().Version}} | ||
| assert.Equal(t, "current: Current.\n"+readHint+"\n", renderText("", list)) | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [nit]
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in beeb396. Dropped TestRunListJSONCarriesMinCLIVersion. The acceptance golden for skills list --output json already checks min_cli_version on future-skill and its absence on the other skills. I kept the text tests for the names-only line and the new-enough case, which the golden does not cover.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed again in 7b6f5f1. The acceptance golden for |
||
|
|
||
| func TestRenderTextNoSkills(t *testing.T) { | ||
| assert.Equal(t, "No skills found.\n", renderText("", nil)) | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit]"github.com/databricks/cli/internal/build"sits in its own group, separated by a blank line from the othergithub.com/databricks/cli/...imports. goimports accepts it, so lint passes, but it splits the first-party group. Drop the blank line so it joins thelibs/...imports.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in the latest push. The
internal/buildimport now sits in the same group as the other first-party imports.