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 31, 2022
1 parent 4d0acf1 commit 8d7d6b9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/poetry/console/commands/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,15 @@ 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 --project path is not a directory.</error>")
return 1

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

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

0 comments on commit 8d7d6b9

Please sign in to comment.