Skip to content

Commit 2d98f77

Browse files
authored
Handle case where content_file is None (#21)
* Fix broken tests * Fix workflow for tests. * Check for `None`. Make sure the path is not a directory.
1 parent 8c7035a commit 2d98f77

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,10 @@ on:
55
push:
66
branches:
77
- main
8-
paths:
9-
- ".github/workflows/test.yml"
10-
- "src/re_plugin_pack/**"
11-
- "tests/**"
12-
- "pyproject.toml"
138
pull_request:
149
paths:
1510
- ".github/workflows/test.yml"
16-
- "src/re_plugin_pack/**"
11+
- "src/**"
1712
- "tests/**"
1813
- "pyproject.toml"
1914
jobs:

src/render_engine_cli/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,14 +216,16 @@ def get_editor(ctx: click.Context, param: click.Option, value: str) -> str | Non
216216

217217
def handle_content_file(ctx: click.Context, param: click.Option, value: str) -> str | None:
218218
"""Handle the content file"""
219+
if value is None:
220+
return ""
219221
if value == "stdin":
220222
content = list()
221223
click.secho('Please enter the content. To finish, put a "." on a blank line.', fg="green")
222224
while (line := input("")) != ".":
223225
content.append(line)
224226
return "\n".join(content)
225227
path = Path(value)
226-
if not path.exists():
228+
if not path.exists() or path.is_dir():
227229
raise click.exceptions.BadParameter(
228230
f'Either the path to a file or "stdin" must be provided. {repr(value)} is invalid.'
229231
)

0 commit comments

Comments
 (0)