pmb.helpers.cli: fix TAB-completion of items with '-' (MR 1960)

Before this fix tab completion of names with hyphens were not done:
try for example to complete UI package name in 'pmbootstrap init' with
hyphen, like "plasma-mobile" / "plasma-desktop". Now this is handled
correctly (hyphen is not considered as delimeter).
This commit is contained in:
Alexey Min 2020-07-12 20:26:28 +03:00 committed by Oliver Smith
parent 44e099acc7
commit aa88721b75
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
1 changed files with 4 additions and 0 deletions

View File

@ -54,6 +54,10 @@ def ask(args, question="Continue?", choices=["y", "n"], default="n",
if complete:
readline.parse_and_bind('tab: complete')
delims = readline.get_completer_delims()
if '-' in delims:
delims = delims.replace('-', '')
readline.set_completer_delims(delims)
readline.set_completer(ReadlineTabCompleter(complete).completer_func)
ret = input(question_full + ": ")