Remove tab auto complete from interactive create
This commit is contained in:
parent
8c58673692
commit
927d4aa1ac
23
jlmkr.py
23
jlmkr.py
|
@ -12,7 +12,6 @@ IT COMES WITHOUT WARRANTY AND IS NOT SUPPORTED BY IXSYSTEMS."""
|
||||||
import argparse
|
import argparse
|
||||||
import configparser
|
import configparser
|
||||||
import contextlib
|
import contextlib
|
||||||
import ctypes
|
|
||||||
import hashlib
|
import hashlib
|
||||||
import io
|
import io
|
||||||
import json
|
import json
|
||||||
|
@ -1166,33 +1165,11 @@ def interactive_config():
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
# Enable tab auto completion of file paths after the = symbol
|
|
||||||
readline.set_completer_delims("=")
|
|
||||||
readline.parse_and_bind("tab: complete")
|
|
||||||
|
|
||||||
readline_lib = ctypes.CDLL(readline.__file__)
|
|
||||||
rl_completer_quote_characters = ctypes.c_char_p.in_dll(
|
|
||||||
readline_lib, "rl_completer_quote_characters"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Let the readline library know about quote characters for completion
|
|
||||||
rl_completer_quote_characters.value = "\"'".encode("utf-8")
|
|
||||||
|
|
||||||
# TODO: more robust tab completion of file paths with space or = character
|
|
||||||
# Currently completing these only works when the path is quoted
|
|
||||||
# https://thoughtbot.com/blog/tab-completion-in-gnu-readline
|
|
||||||
# https://stackoverflow.com/a/67118744
|
|
||||||
# https://github.com/python-cmd2/cmd2/blob/ee7599f9ac0dbb6ce3793f6b665ba1200d3ef9a3/cmd2/cmd2.py
|
|
||||||
# https://stackoverflow.com/a/40152927
|
|
||||||
|
|
||||||
config.my_set(
|
config.my_set(
|
||||||
"systemd_nspawn_user_args",
|
"systemd_nspawn_user_args",
|
||||||
"\n ".join(shlex.split(input("Additional flags: ") or "")),
|
"\n ".join(shlex.split(input("Additional flags: ") or "")),
|
||||||
)
|
)
|
||||||
|
|
||||||
# Disable tab auto completion
|
|
||||||
readline.parse_and_bind("tab: self-insert")
|
|
||||||
|
|
||||||
print(
|
print(
|
||||||
dedent(
|
dedent(
|
||||||
f"""
|
f"""
|
||||||
|
|
Loading…
Reference in New Issue