diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-12-10 10:18:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-12-10 10:18:43 +0000 |
commit | 44ba8147bbb1b651867b4b04e1711273d4a7281c (patch) | |
tree | d8c169e12006bfa46e436a180fd531aaac08aad5 /litecli/packages/special/utils.py | |
parent | Adding upstream version 1.9.0. (diff) | |
download | litecli-44ba8147bbb1b651867b4b04e1711273d4a7281c.tar.xz litecli-44ba8147bbb1b651867b4b04e1711273d4a7281c.zip |
Adding upstream version 1.10.0.upstream/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 |