Skip to content

Commit

Permalink
Fix install app template from repo with different name
Browse files Browse the repository at this point in the history
  • Loading branch information
doshitan committed Dec 27, 2024
1 parent de7279a commit 98c85aa
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
16 changes: 14 additions & 2 deletions nava/platform/cli/commands/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,18 @@ def install(
commit: Annotated[
bool, typer.Option(help="Commit changes with standard message if able")
] = False,
template_name: Annotated[
str | None,
typer.Option(
help="The name of the template. Usually this can be derived from the repository name automatically, but if you are running from a local checkout under a different name, you will need to specify the upstream name here."
),
] = None,
) -> None:
"""Install application template in project."""
ctx = typer_context.ensure_object(CliContext)

with ctx.handle_exceptions():
template = Template(ctx, template_uri=template_uri)
template = Template(ctx, template_uri=template_uri, template_name=template_name)
project = Project(project_dir)
template.install(
project=project,
Expand Down Expand Up @@ -65,6 +71,12 @@ def update(
commit: Annotated[
bool, typer.Option(help="Commit changes with standard message if able")
] = True,
template_name: Annotated[
str | None,
typer.Option(
help="The name of the template. Usually this can be derived from the repository name automatically, but if you are running from a local checkout under a different name, you will need to specify the upstream name here."
),
] = None,
) -> None:
"""Update application based on template in project."""
ctx = typer_context.ensure_object(CliContext)
Expand All @@ -73,7 +85,7 @@ def update(
project = Project(project_dir)

if template_uri:
template = Template(ctx, template_uri=template_uri)
template = Template(ctx, template_uri=template_uri, template_name=template_name)
else:
installed_templates_for_app = list(
filter(
Expand Down
4 changes: 3 additions & 1 deletion nava/platform/templates/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ def from_existing(
f"Can not determine existing template `{template_name}` source for `{app_name}`"
)

return cls(ctx, template_uri=template_uri, src_excludes=src_excludes)
return cls(
ctx, template_uri=template_uri, template_name=template_name, src_excludes=src_excludes
)

def install(
self,
Expand Down

0 comments on commit 98c85aa

Please sign in to comment.