Commit 544b4a14 by finswimmer Committed by Bjorn Neergaard

feat(cli): added cli option to specify path to project to run on

parent 281b11a8
...@@ -121,8 +121,13 @@ class Application(BaseApplication): # type: ignore[misc] ...@@ -121,8 +121,13 @@ class Application(BaseApplication): # type: ignore[misc]
if self._poetry is not None: if self._poetry is not None:
return self._poetry return self._poetry
project_path = Path.cwd()
if self._io and self._io.input.option("directory"):
project_path = self._io.input.option("directory")
self._poetry = Factory().create_poetry( self._poetry = Factory().create_poetry(
Path.cwd(), cwd=project_path,
io=self._io, io=self._io,
disable_plugins=self._disable_plugins, disable_plugins=self._disable_plugins,
disable_cache=self._disable_cache, disable_cache=self._disable_cache,
...@@ -367,6 +372,18 @@ class Application(BaseApplication): # type: ignore[misc] ...@@ -367,6 +372,18 @@ class Application(BaseApplication): # type: ignore[misc]
) )
) )
definition.add_option(
Option(
"--directory",
"-C",
flag=False,
description=(
"The working directory for the Poetry command (defaults to the"
" current working directory)."
),
)
)
return definition return definition
def _get_solution_provider_repository(self) -> SolutionProviderRepository: def _get_solution_provider_repository(self) -> SolutionProviderRepository:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment