summaryrefslogtreecommitdiffstats
path: root/litecli
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-03-17 19:03:25 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-03-17 19:13:27 +0000
commitbd0dfb88fdf5714833466787fd73edaff9740a73 (patch)
treec53a5ef22f910c748c48a0e0d587755ec6f405b0 /litecli
parentReleasing debian version 1.5.0-3. (diff)
downloadlitecli-bd0dfb88fdf5714833466787fd73edaff9740a73.tar.xz
litecli-bd0dfb88fdf5714833466787fd73edaff9740a73.zip
Merging upstream version 1.6.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'litecli')
-rw-r--r--litecli/__init__.py2
-rw-r--r--litecli/liteclirc1
-rw-r--r--litecli/main.py4
-rw-r--r--litecli/packages/parseutils.py2
-rw-r--r--litecli/packages/special/iocommands.py3
-rw-r--r--litecli/sqlexecute.py1
6 files changed, 7 insertions, 6 deletions
diff --git a/litecli/__init__.py b/litecli/__init__.py
index 5b60188..e4adfb8 100644
--- a/litecli/__init__.py
+++ b/litecli/__init__.py
@@ -1 +1 @@
-__version__ = "1.5.0"
+__version__ = "1.6.0"
diff --git a/litecli/liteclirc b/litecli/liteclirc
index e3331d1..5bfffbd 100644
--- a/litecli/liteclirc
+++ b/litecli/liteclirc
@@ -55,6 +55,7 @@ wider_completion_menu = False
# litecli prompt
# \D - The full current date
# \d - Database name
+# \f - File basename of the "main" database
# \m - Minutes of the current time
# \n - Newline
# \P - AM/PM
diff --git a/litecli/main.py b/litecli/main.py
index 5768851..24b1bb4 100644
--- a/litecli/main.py
+++ b/litecli/main.py
@@ -704,8 +704,7 @@ class LiteCli(object):
]
def _on_completions_refreshed(self, new_completer):
- """Swap the completer object in cli with the newly created completer.
- """
+ """Swap the completer object in cli with the newly created completer."""
with self._completer_lock:
self.completer = new_completer
@@ -725,6 +724,7 @@ class LiteCli(object):
sqlexecute = self.sqlexecute
now = datetime.now()
string = string.replace("\\d", sqlexecute.dbname or "(none)")
+ string = string.replace("\\f", os.path.basename(sqlexecute.dbname or "(none)"))
string = string.replace("\\n", "\n")
string = string.replace("\\D", now.strftime("%a %b %d %H:%M:%S %Y"))
string = string.replace("\\m", now.strftime("%M"))
diff --git a/litecli/packages/parseutils.py b/litecli/packages/parseutils.py
index 92fe365..3f5ca61 100644
--- a/litecli/packages/parseutils.py
+++ b/litecli/packages/parseutils.py
@@ -166,7 +166,7 @@ def extract_tables(sql):
def find_prev_keyword(sql):
- """ Find the last sql keyword in an SQL statement
+ """Find the last sql keyword in an SQL statement
Returns the value of the last keyword, and the text of the query with
everything after the last keyword stripped
diff --git a/litecli/packages/special/iocommands.py b/litecli/packages/special/iocommands.py
index 8940057..43c3577 100644
--- a/litecli/packages/special/iocommands.py
+++ b/litecli/packages/special/iocommands.py
@@ -276,8 +276,7 @@ def save_favorite_query(arg, **_):
@special_command("\\fd", "\\fd [name]", "Delete a favorite query.")
def delete_favorite_query(arg, **_):
- """Delete an existing favorite query.
- """
+ """Delete an existing favorite query."""
usage = "Syntax: \\fd name.\n\n" + favoritequeries.usage
if not arg:
return [(None, None, None, usage)]
diff --git a/litecli/sqlexecute.py b/litecli/sqlexecute.py
index 7ef103c..2b8fce3 100644
--- a/litecli/sqlexecute.py
+++ b/litecli/sqlexecute.py
@@ -61,6 +61,7 @@ class SQLExecute(object):
raise Exception("Path does not exist: {}".format(db_dir_name))
conn = sqlite3.connect(database=db_name, isolation_level=None)
+ conn.text_factory = lambda x: x.decode("utf-8", "backslashreplace")
if self.conn:
self.conn.close()