clan-cli: Fix incorrect input handling in get_templates
This commit is contained in:
@@ -113,9 +113,10 @@ def register_create_parser(parser: argparse.ArgumentParser) -> None:
|
|||||||
type=str,
|
type=str,
|
||||||
help="""Flake input name to use as template source
|
help="""Flake input name to use as template source
|
||||||
can be specified multiple times, inputs are tried in order of definition
|
can be specified multiple times, inputs are tried in order of definition
|
||||||
|
Example: --input clan --input clan-core
|
||||||
""",
|
""",
|
||||||
action="append",
|
action="append",
|
||||||
default=["clan-core"],
|
default=[],
|
||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
@@ -147,6 +148,9 @@ def register_create_parser(parser: argparse.ArgumentParser) -> None:
|
|||||||
)
|
)
|
||||||
|
|
||||||
def create_flake_command(args: argparse.Namespace) -> None:
|
def create_flake_command(args: argparse.Namespace) -> None:
|
||||||
|
if len(args.input) == 0:
|
||||||
|
args.input = ["clan", "clan-core"]
|
||||||
|
|
||||||
if args.no_self:
|
if args.no_self:
|
||||||
input_prio = InputPrio.try_inputs(tuple(args.input))
|
input_prio = InputPrio.try_inputs(tuple(args.input))
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -136,6 +136,9 @@ def create_command(args: argparse.Namespace) -> None:
|
|||||||
)
|
)
|
||||||
raise ClanError(msg, description=description)
|
raise ClanError(msg, description=description)
|
||||||
|
|
||||||
|
if len(args.input) == 0:
|
||||||
|
args.input = ["clan", "clan-core"]
|
||||||
|
|
||||||
if args.no_self:
|
if args.no_self:
|
||||||
input_prio = InputPrio.try_inputs(tuple(args.input))
|
input_prio = InputPrio.try_inputs(tuple(args.input))
|
||||||
else:
|
else:
|
||||||
@@ -185,9 +188,10 @@ def register_create_parser(parser: argparse.ArgumentParser) -> None:
|
|||||||
type=str,
|
type=str,
|
||||||
help="""Flake input name to use as template source
|
help="""Flake input name to use as template source
|
||||||
can be specified multiple times, inputs are tried in order of definition
|
can be specified multiple times, inputs are tried in order of definition
|
||||||
|
Example: --input clan --input clan-core
|
||||||
""",
|
""",
|
||||||
action="append",
|
action="append",
|
||||||
default=["clan-core"],
|
default=[],
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--no-self",
|
"--no-self",
|
||||||
|
|||||||
@@ -237,7 +237,9 @@ def get_template(
|
|||||||
input_name = InputName(input_name_str)
|
input_name = InputName(input_name_str)
|
||||||
log.debug(f"Checking input '{input_name}' for template '{template_name}'")
|
log.debug(f"Checking input '{input_name}' for template '{template_name}'")
|
||||||
|
|
||||||
template = find_template(template_name, template_list.inputs[input_name])
|
template = find_template(
|
||||||
|
template_name, template_list.inputs.get(input_name, {})
|
||||||
|
)
|
||||||
if template:
|
if template:
|
||||||
log.debug(f"Found template '{template_name}' in input '{input_name}'")
|
log.debug(f"Found template '{template_name}' in input '{input_name}'")
|
||||||
break # Stop searching once the template is found
|
break # Stop searching once the template is found
|
||||||
|
|||||||
Reference in New Issue
Block a user