Skip to content

Commit

Permalink
fix: made verbose tabcomplete init prints into debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Oct 30, 2023
1 parent 264b609 commit 84e68c6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions gptme/tabcomplete.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
import logging
import readline
from functools import lru_cache
from pathlib import Path

from .commands import CMDFIX, COMMANDS

logger = logging.getLogger(__name__)


def register_tabcomplete() -> None:
"""Register tab completion for readline."""

# set up tab completion
print("Setting up tab completion")
logger.debug("Setting up tab completion")
readline.set_completer(_completer)
readline.set_completer_delims(" ")
readline.parse_and_bind("tab: complete")

# https://github.com/python/cpython/issues/102130#issuecomment-1439242363
if "libedit" in readline.__doc__: # type: ignore
print("Found libedit readline")
logger.debug("Found libedit readline")
readline.parse_and_bind("bind ^I rl_complete")
else:
print("Found gnu readline")
logger.debug("Found gnu readline")
readline.parse_and_bind("tab: complete")


Expand Down

0 comments on commit 84e68c6

Please sign in to comment.