Skip to content

Commit

Permalink
feat(cli): interpret --project option for init as target folder
Browse files Browse the repository at this point in the history
  • Loading branch information
finswimmer committed Oct 15, 2022
1 parent 85eedca commit 93e527f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/poetry/console/commands/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,18 @@ def handle(self) -> int:
from poetry.layouts import layout
from poetry.utils.env import SystemEnv

pyproject = PyProjectTOML(Path.cwd() / "pyproject.toml")
project_path = Path.cwd()

if self.io.input.option("project"):
project_path = Path(self.io.input.option("project"))
if not project_path.exists() or not project_path.is_dir():
self.line_error(
"<error>The given target for the project does not exists or is not"
" a folder.</error>"
)
return 1

pyproject = PyProjectTOML(project_path / "pyproject.toml")

if pyproject.file.exists():
if pyproject.is_poetry_project():
Expand Down

0 comments on commit 93e527f

Please sign in to comment.