summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartijn Pieters <github.com@zopatista.com>2022-07-10 15:22:12 +0100
committerGitHub <noreply@github.com>2022-07-10 14:26:52 +0000
commit3f6013f007c8f01956e07faf0f3d044c7c43b35c (patch)
tree94e9cdc8ee79909b54f1cca8747e44975366273b
parentc68d8027cb24b0085d5a5feeac8e2a61f668b8da (diff)
Make it possible to use .once more than once
When .once has been used, reset `written_to_once_file` as otherwise `once_file` is cleared after every subsequent command, including additional `.once` commands.
-rw-r--r--CHANGELOG.md7
-rw-r--r--litecli/packages/special/iocommands.py4
2 files changed, 9 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index afeebd1..6c15b38 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,10 @@
+## TBD
+
+### Bug Fixes
+
+* Fix [[#146](https://github.com/dbcli/litecli/issues/146)], making sure `.once`
+ can be used more than once in a session.
+
## 1.9.0 - 2022-06-06
### Features
diff --git a/litecli/packages/special/iocommands.py b/litecli/packages/special/iocommands.py
index 92ea444..0429430 100644
--- a/litecli/packages/special/iocommands.py
+++ b/litecli/packages/special/iocommands.py
@@ -405,9 +405,9 @@ def write_once(output):
@export
def unset_once_if_written():
"""Unset the once file, if it has been written to."""
- global once_file
+ global once_file, written_to_once_file
if written_to_once_file:
- once_file = None
+ once_file = written_to_once_file = None
@special_command(