Skip to content

Commit

Permalink
use project's ea setting in query templates
Browse files Browse the repository at this point in the history
  • Loading branch information
12944qwerty committed Feb 12, 2024
1 parent 6155522 commit 6ac3d19
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion pros/cli/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,13 @@ def callback(ctx: click.Context, param: click.Parameter, value: str):
if project_path is None:
if allow_none:
return None
else:
elif required:
raise click.UsageError(f'{os.path.abspath(value or ".")} is not inside a PROS project. '
f'Execute this command from within a PROS project or specify it '
f'with --project project/path')
else:
return None

return c.Project(project_path)

def wrapper(f: Union[click.Command, Callable]):
Expand Down
7 changes: 5 additions & 2 deletions pros/cli/conductor.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,12 @@ def new_project(ctx: click.Context, path: str, target: str, version: str,
@click.option('--limit', type=int, default=15,
help='The maximum number of displayed results for each library')
@click.option('--early-access/--no-early-access', '--early/--no-early', '-ea/-nea', 'early_access', '--beta/--no-beta', default=None,
help='Create a project using the PROS 4 kernel')
help='View a list of early access templates')
@template_query(required=False)
@project_option(required=False)
@click.pass_context
@default_options
def query_templates(ctx, query: c.BaseTemplate, allow_offline: bool, allow_online: bool, force_refresh: bool,
def query_templates(ctx, project: Optional[c.Project], query: c.BaseTemplate, allow_offline: bool, allow_online: bool, force_refresh: bool,
limit: int, early_access: bool):
"""
Query local and remote templates based on a spec
Expand All @@ -273,6 +274,8 @@ def query_templates(ctx, query: c.BaseTemplate, allow_offline: bool, allow_onlin
analytics.send("query-templates")
if limit < 0:
limit = 15
if early_access is None and project is not None:
early_access = project.use_early_access
templates = c.Conductor().resolve_templates(query, allow_offline=allow_offline, allow_online=allow_online,
force_refresh=force_refresh, early_access=early_access)
render_templates = {}
Expand Down

0 comments on commit 6ac3d19

Please sign in to comment.