mirror of
https://github.com/simonw/files-to-prompt.git
synced 2025-10-23 00:02:47 +03:00
-m shortcut for --markdown, refs #42
This commit is contained in:
@@ -64,7 +64,7 @@ This will output the contents of every file, with each file preceded by its rela
|
|||||||
files-to-prompt path/to/directory --cxml
|
files-to-prompt path/to/directory --cxml
|
||||||
```
|
```
|
||||||
|
|
||||||
- `--markdown`: Output as Markdown with fenced code blocks.
|
- `-m/--markdown`: Output as Markdown with fenced code blocks.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
files-to-prompt path/to/directory --markdown
|
files-to-prompt path/to/directory --markdown
|
||||||
|
|||||||
@@ -225,6 +225,8 @@ def read_paths_from_stdin(use_null_separator):
|
|||||||
help="Output in XML-ish format suitable for Claude's long context window.",
|
help="Output in XML-ish format suitable for Claude's long context window.",
|
||||||
)
|
)
|
||||||
@click.option(
|
@click.option(
|
||||||
|
"markdown",
|
||||||
|
"-m",
|
||||||
"--markdown",
|
"--markdown",
|
||||||
is_flag=True,
|
is_flag=True,
|
||||||
help="Output Markdown with fenced code blocks",
|
help="Output Markdown with fenced code blocks",
|
||||||
|
|||||||
@@ -377,7 +377,8 @@ def test_paths_from_arguments_and_stdin(tmpdir):
|
|||||||
assert "Contents of file2" in result.output
|
assert "Contents of file2" in result.output
|
||||||
|
|
||||||
|
|
||||||
def test_markdown(tmpdir):
|
@pytest.mark.parametrize("option", ("-m", "--markdown"))
|
||||||
|
def test_markdown(tmpdir, option):
|
||||||
runner = CliRunner()
|
runner = CliRunner()
|
||||||
with tmpdir.as_cwd():
|
with tmpdir.as_cwd():
|
||||||
os.makedirs("test_dir")
|
os.makedirs("test_dir")
|
||||||
@@ -389,7 +390,7 @@ def test_markdown(tmpdir):
|
|||||||
f.write("This is javascript")
|
f.write("This is javascript")
|
||||||
with open("test_dir/code.unknown", "w") as f:
|
with open("test_dir/code.unknown", "w") as f:
|
||||||
f.write("This is an unknown file type")
|
f.write("This is an unknown file type")
|
||||||
result = runner.invoke(cli, ["test_dir", "--markdown"])
|
result = runner.invoke(cli, ["test_dir", option])
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
actual = result.output
|
actual = result.output
|
||||||
expected = (
|
expected = (
|
||||||
|
|||||||
Reference in New Issue
Block a user