pmb.helpers.cli: set empty completer for no completion (MR 2055)

The default completer suggests files from the file system which we
really don't want here.
This can be tested with the 'Manufacturer' field for new devices.

Setting it to a custom lambda instead of None disables the completion
instead of using the default completer.
This commit is contained in:
Luca Weiss 2021-05-06 20:19:14 +02:00 committed by Clayton Craft
parent 81dbabc1ed
commit c42cd93610
No known key found for this signature in database
GPG key ID: 7A3461CA187CEA54

View file

@ -68,7 +68,8 @@ def ask(args, question="Continue?", choices=["y", "n"], default="n",
# Stop completing (question is answered)
if complete:
readline.set_completer(None)
# set_completer(None) would use the default file system completer
readline.set_completer(lambda text, state: None)
if lowercase_answer:
ret = ret.lower()