diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-12-10 10:18:47 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-12-10 10:18:47 +0000 |
commit | f969bdef4f3403e22b0a7bf84d0d4e86c2428a77 (patch) | |
tree | c7ee1703b3aec5e43412c64fee1fea665c6b3086 /litecli/packages/special/utils.py | |
parent | Releasing debian version 1.9.0-3. (diff) | |
download | litecli-f969bdef4f3403e22b0a7bf84d0d4e86c2428a77.tar.xz litecli-f969bdef4f3403e22b0a7bf84d0d4e86c2428a77.zip |
Merging upstream version 1.10.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'litecli/packages/special/utils.py')
-rw-r--r-- | litecli/packages/special/utils.py | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/litecli/packages/special/utils.py b/litecli/packages/special/utils.py index eed9306..4d3ad91 100644 --- a/litecli/packages/special/utils.py +++ b/litecli/packages/special/utils.py @@ -46,3 +46,86 @@ def format_uptime(uptime_in_seconds): uptime = " ".join(uptime_values) return uptime + + +def check_if_sqlitedotcommand(command): + """Does a check if the command supplied is in the list of SQLite dot commands. + + :param command: A command (str) supplied from the user + :returns: True/False + """ + + sqlite3dotcommands = [ + ".archive", + ".auth", + ".backup", + ".bail", + ".binary", + ".cd", + ".changes", + ".check", + ".clone", + ".connection", + ".databases", + ".dbconfig", + ".dbinfo", + ".dump", + ".echo", + ".eqp", + ".excel", + ".exit", + ".expert", + ".explain", + ".filectrl", + ".fullschema", + ".headers", + ".help", + ".import", + ".imposter", + ".indexes", + ".limit", + ".lint", + ".load", + ".log", + ".mode", + ".nonce", + ".nullvalue", + ".once", + ".open", + ".output", + ".parameter", + ".print", + ".progress", + ".prompt", + ".quit", + ".read", + ".recover", + ".restore", + ".save", + ".scanstats", + ".schema", + ".selftest", + ".separator", + ".session", + ".sha3sum", + ".shell", + ".show", + ".stats", + ".system", + ".tables", + ".testcase", + ".testctrl", + ".timeout", + ".timer", + ".trace", + ".vfsinfo", + ".vfslist", + ".vfsname", + ".width", + ] + + if isinstance(command, str): + command = command.split(" ", 1)[0].lower() + return command in sqlite3dotcommands + else: + return False |