Removed ws with_parents
All checks were successful
Test before pr merge / test-lint (pull_request) Successful in 7s
Build on push / prepare (push) Successful in 10s
Build on push / query (push) Successful in 19s
Build on push / core (push) Successful in 22s
Build on push / cli (push) Successful in 16s
Build on push / dependency (push) Successful in 19s
Build on push / mail (push) Successful in 17s
Build on push / application (push) Successful in 21s
Build on push / translation (push) Successful in 20s
Build on push / database (push) Successful in 21s
Build on push / auth (push) Successful in 19s
Build on push / api (push) Successful in 15s
All checks were successful
Test before pr merge / test-lint (pull_request) Successful in 7s
Build on push / prepare (push) Successful in 10s
Build on push / query (push) Successful in 19s
Build on push / core (push) Successful in 22s
Build on push / cli (push) Successful in 16s
Build on push / dependency (push) Successful in 19s
Build on push / mail (push) Successful in 17s
Build on push / application (push) Successful in 21s
Build on push / translation (push) Successful in 20s
Build on push / database (push) Successful in 21s
Build on push / auth (push) Successful in 19s
Build on push / api (push) Successful in 15s
This commit is contained in:
@@ -31,7 +31,7 @@ def init(target: str, name: str, verbose: bool = False):
|
|||||||
if target in ["workspace", "ws"]:
|
if target in ["workspace", "ws"]:
|
||||||
workspace = Structure.init_workspace("./", name or click.prompt("Workspace name", default="my-workspace"))
|
workspace = Structure.init_workspace("./", name or click.prompt("Workspace name", default="my-workspace"))
|
||||||
elif target in PROJECT_TYPES:
|
elif target in PROJECT_TYPES:
|
||||||
workspace = Structure.find_workspace_in_path(Path(name or "./").parent, with_parents=True)
|
workspace = Structure.find_workspace_in_path(Path(name or "./").parent)
|
||||||
project = Structure.init_project(
|
project = Structure.init_project(
|
||||||
"./", name or click.prompt("Project name", default=f"my-{target}"), target, workspace, verbose=verbose
|
"./", name or click.prompt("Project name", default=f"my-{target}"), target, workspace, verbose=verbose
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ def new(type: str, name: str, in_name: str | None, project: list[str] | None, ve
|
|||||||
path = Path(workspace.path).parent / Path(project[1]).parent
|
path = Path(workspace.path).parent / Path(project[1]).parent
|
||||||
project_name = Path(project[1]).stem
|
project_name = Path(project[1]).stem
|
||||||
|
|
||||||
workspace = Structure.find_workspace_in_path(path, with_parents=False)
|
workspace = Structure.find_workspace_in_path(path)
|
||||||
if workspace is None:
|
if workspace is None:
|
||||||
Console.error("No workspace found. Please run 'cpl init workspace' first.")
|
Console.error("No workspace found. Please run 'cpl init workspace' first.")
|
||||||
raise SystemExit(1)
|
raise SystemExit(1)
|
||||||
|
|||||||
@@ -32,11 +32,9 @@ class Structure:
|
|||||||
}
|
}
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def find_workspace_in_path(path: Path, with_parents=False) -> Workspace | None:
|
def find_workspace_in_path(path: Path) -> Workspace | None:
|
||||||
current_path = path.resolve()
|
current_path = path.resolve()
|
||||||
paths = [current_path]
|
paths = [current_path, *current_path.parents]
|
||||||
if with_parents:
|
|
||||||
paths.extend(current_path.parents)
|
|
||||||
|
|
||||||
for parent in paths:
|
for parent in paths:
|
||||||
workspace_file = parent / "cpl.workspace.json"
|
workspace_file = parent / "cpl.workspace.json"
|
||||||
@@ -84,7 +82,7 @@ class Structure:
|
|||||||
|
|
||||||
return Project.from_file(path)
|
return Project.from_file(path)
|
||||||
|
|
||||||
workspace = Structure.find_workspace_in_path(path.parent, with_parents=True)
|
workspace = Structure.find_workspace_in_path(path.parent)
|
||||||
if workspace is None:
|
if workspace is None:
|
||||||
raise RuntimeError("No workspace found. Please run 'cpl init workspace' first.")
|
raise RuntimeError("No workspace found. Please run 'cpl init workspace' first.")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user