if not source or source.isspace():
return False
+ # Remember to update CLI_COMMANDS in _completer.py
if source[0] == ".":
match source[1:].strip():
case "version":
except ImportError:
SQLITE_KEYWORDS = ()
+CLI_COMMANDS = ('.quit', '.help', '.version')
+
_completion_matches = []
global _completion_matches
if state == 0:
- text_upper = text.upper()
- _completion_matches = [c for c in SQLITE_KEYWORDS if c.startswith(text_upper)]
+ if text.startswith('.'):
+ _completion_matches = [c for c in CLI_COMMANDS if c.startswith(text)]
+ else:
+ text_upper = text.upper()
+ _completion_matches = [c for c in SQLITE_KEYWORDS if c.startswith(text_upper)]
try:
return _completion_matches[state] + " "
except IndexError:
self.assertIn(b"SELECT", output)
self.assertIn(b"(1,)", output)
+ # .commands are completed without changing case
+ input_ = b".ver\t\n.quit\n"
+ output = self.write_input(input_)
+ self.assertIn(b".version", output)
+
@unittest.skipIf(sys.platform.startswith("freebsd"),
"Two actual tabs are inserted when there are no matching"
" completions in the pseudo-terminal opened by run_pty()"