feat(cli): add interactive tab completion for image type selection

This commit is contained in:
Roland Huß 2025-04-25 13:55:59 +02:00
parent 59b7593609
commit 8f701a831d
No known key found for this signature in database
GPG key ID: 81D53EB87CDFBC34

View file

@ -136,12 +136,13 @@ def run_stack_build_command(args: argparse.Namespace) -> None:
) )
image_type = prompt( image_type = prompt(
f"> Enter the image type you want your Llama Stack to be built as ({' or '.join(e.value for e in ImageType)}): ", f"> Enter the image type you want your Llama Stack to be built as (use <TAB> to see options): ",
completer=WordCompleter([e.value for e in ImageType]),
complete_while_typing=True,
validator=Validator.from_callable( validator=Validator.from_callable(
lambda x: x in [e.value for e in ImageType], lambda x: x in [e.value for e in ImageType],
error_message=f"Invalid image type, please enter {' or '.join(e.value for e in ImageType)}", error_message="Invalid image type. Use <TAB> to see options",
), ),
default=ImageType.CONDA.value,
) )
if image_type == ImageType.CONDA.value: if image_type == ImageType.CONDA.value: