Repository navigation
skills read: end flags before a leading-hyphen file name #8121
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
Changes from all commits
4243c2a
2a5b94f
c18cfe7
e73a6a0
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 |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Notes that start with a hyphen. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,6 +27,28 @@ func TestWriteReadTextQuotesFileCommands(t *testing.T) { | |
| assert.Contains(t, out.String(), " databricks skills read-file guide-skill \"references/my guide.md\"\n") | ||
| } | ||
|
|
||
| func TestWriteReadTextEndsFlagsBeforeLeadingHyphenFile(t *testing.T) { | ||
|
Contributor
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] No case uses a leading-hyphen value that also needs quotes, for example
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 c18cfe7: |
||
| var out bytes.Buffer | ||
| err := writeReadText(&out, "linux", "guide-skill", []byte("# Guide\n"), []string{"-notes.md", "references/ok.md"}) | ||
| require.NoError(t, err) | ||
| assert.Contains(t, out.String(), " databricks skills read-file -- guide-skill -notes.md\n databricks skills read-file guide-skill references/ok.md\n") | ||
|
|
||
| out.Reset() | ||
| err = writeReadText(&out, "linux", "-guide-skill", []byte("# Guide\n"), []string{"references/ok.md"}) | ||
| require.NoError(t, err) | ||
| assert.Contains(t, out.String(), " databricks skills read-file -- -guide-skill references/ok.md\n") | ||
|
|
||
| out.Reset() | ||
| err = writeReadText(&out, "linux", "guide-skill", []byte("# Guide\n"), []string{"-my notes.md"}) | ||
| require.NoError(t, err) | ||
| assert.Contains(t, out.String(), " databricks skills read-file -- guide-skill '-my notes.md'\n") | ||
|
|
||
| out.Reset() | ||
| err = writeReadText(&out, "windows", "guide-skill", []byte("# Guide\n"), []string{"-my notes.md"}) | ||
| require.NoError(t, err) | ||
| assert.Contains(t, out.String(), " databricks skills read-file -- guide-skill \"-my notes.md\"\n") | ||
| } | ||
|
|
||
| func TestWriteReadTextPrintsPathWithoutCommandWhenItCannotBeQuoted(t *testing.T) { | ||
| var out bytes.Buffer | ||
| err := writeReadText(&out, "linux", "guide-skill", []byte("# Guide\n"), []string{"references/a\nb.md", "references/ok.md"}) | ||
|
|
||
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.
[Question] Did you run the printed
databricks skills read-file -- guide-skill -notes.mdline in Windows PowerShell 5.1? Windows PowerShell can change native arguments that start with-, and the Windows CI runs the acceptance script in bash. The answer tells if the printed command runs as printed on Windows.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.
No, I did not run the printed command in Windows PowerShell 5.1, and this environment has no Windows PowerShell. The Windows CI runs the acceptance script in bash, so it does not cover PowerShell either. The Windows unit test only checks the printed text. This is unverified, and I made no code change for it. The printed form is the one the ticket asks for.