diff --git a/CHANGES/1008.bugfix b/CHANGES/1008.bugfix new file mode 100644 index 000000000..9b8aff12f --- /dev/null +++ b/CHANGES/1008.bugfix @@ -0,0 +1 @@ +Fixed the interactive config generation in the face of options allowing multiple values. diff --git a/pulp_cli/config.py b/pulp_cli/config.py index f0a3e8303..07d8d61b0 100644 --- a/pulp_cli/config.py +++ b/pulp_cli/config.py @@ -220,11 +220,17 @@ def _check_location(location: str) -> None: def prompt_config_option(name: str) -> t.Any: """Find the option from the root command and prompt.""" option = next(p for p in ctx.command.params if p.name == name) - if isinstance(option, click.Option) and option.help: - help = option.help + if option.multiple: + assert option.type == click.types.STRING + assert option.default is None + result = [] + value = click.prompt(f"{name} (end with an empty line)", default="", type=option.type) + while value: + result.append(value) + value = click.prompt(f"{name} (continued)", default="", type=option.type) + return result else: - help = name - return click.prompt(help, default=(option.default), type=option.type) + return click.prompt(name, default=option.default, type=option.type) settings: t.MutableMapping[str, t.Any] = kwargs if not settings["plugins"]: