summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-11-15 06:46:32 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-11-15 06:46:32 +0000
commit570030879001869cc11575fc1869176719aa99f8 (patch)
tree1f2c4f2fd1864ef6bcd85da10c4c7dfac8f8b217
parentReleasing debian version 1.12.3-1. (diff)
downloadlitecli-570030879001869cc11575fc1869176719aa99f8.tar.xz
litecli-570030879001869cc11575fc1869176719aa99f8.zip
Merging upstream version 1.12.4.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--CHANGELOG.md60
-rw-r--r--README.md3
-rw-r--r--litecli/__init__.py2
-rw-r--r--litecli/packages/special/dbcommands.py3
-rw-r--r--tests/test_dbspecial.py19
-rw-r--r--tests/test_sqlexecute.py26
-rw-r--r--tests/utils.py24
7 files changed, 71 insertions, 66 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7bda87b..58f8192 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,14 +1,8 @@
-## Upcoming - TBD
-
-
-### Features
-
+## 1.12.4 - 2024-11-11
### Bug Fixes
-
-### Internal Changes
-
+* Fix the syntax error when `\d tbl` is used.
## 1.12.3 - 2024-09-10
@@ -17,7 +11,6 @@
* Specify build system in `pyproject.toml`
* Don't install tests
-
## 1.12.2 - 2024-09-07
### Bug Fixes
@@ -40,7 +33,6 @@
* Fix the escape sequence warning.
-
## 1.11.0 - 2024-05-03
### Improvements
@@ -48,19 +40,16 @@
* When an empty `\d` is invoked the list of tables are returned instead of an error.
* Show SQLite version at startup.
-
### Bug Fixes
* Support a single item in the startup commands in the config. (bug #176)
-
## 1.10.1 - 2024-3-23
### Bug Fixes
* Do not crash at start up if ~/.config/litecli is not writeable. [#172](https://github.com/dbcli/litecli/issues/172)
-
## 1.10.0 - 2022-11-19
### Features
@@ -82,7 +71,6 @@
* Skip internal indexes in the .schema output
([#170](https://github.com/dbcli/litecli/issues/170)).
-
## 1.9.0 - 2022-06-06
### Features
@@ -125,72 +113,70 @@
### Features
-- Add verbose feature to `favorite_query` command. (Thanks: [Zhaolong Zhu])
- - `\f query` does not show the full SQL.
- - `\f+ query` shows the full SQL.
-- Add prompt format of file's basename. (Thanks: [elig0n])
+* Add verbose feature to `favorite_query` command. (Thanks: [Zhaolong Zhu])
+ * `\f query` does not show the full SQL.
+ * `\f+ query` shows the full SQL.
+* Add prompt format of file's basename. (Thanks: [elig0n])
### Bug Fixes
-- Fix compatibility with sqlparse >= 0.4.0. (Thanks: [chocolateboy])
-- Fix invalid utf-8 exception. (Thanks: [Amjith])
+* Fix compatibility with sqlparse >= 0.4.0. (Thanks: [chocolateboy])
+* Fix invalid utf-8 exception. (Thanks: [Amjith])
## 1.4.1 - 2020-07-27
### Bug Fixes
-- Fix setup.py to set `long_description_content_type` as markdown.
+* Fix setup.py to set `long_description_content_type` as markdown.
## 1.4.0 - 2020-07-27
### Features
-- Add NULLS FIRST and NULLS LAST to keywords. (Thanks: [Amjith])
+* Add NULLS FIRST and NULLS LAST to keywords. (Thanks: [Amjith])
## 1.3.2 - 2020-03-11
-- Fix the completion engine to work with newer sqlparse.
+* Fix the completion engine to work with newer sqlparse.
## 1.3.1 - 2020-03-11
-- Remove the version pinning of sqlparse package.
+* Remove the version pinning of sqlparse package.
## 1.3.0 - 2020-02-11
### Features
-- Added `.import` command for importing data from file into table. (Thanks: [Zhaolong Zhu])
-- Upgraded to prompt-toolkit 3.x.
+* Added `.import` command for importing data from file into table. (Thanks: [Zhaolong Zhu])
+* Upgraded to prompt-toolkit 3.x.
## 1.2.0 - 2019-10-26
### Features
-- Enhance the `describe` command. (Thanks: [Amjith])
-- Autocomplete table names for special commands. (Thanks: [Amjith])
+* Enhance the `describe` command. (Thanks: [Amjith])
+* Autocomplete table names for special commands. (Thanks: [Amjith])
## 1.1.0 - 2019-07-14
### Features
-- Added `.read` command for reading scripts.
-- Added `.load` command for loading extension libraries. (Thanks: [Zhiming Wang])
-- Add support for using `?` as a placeholder in the favorite queries. (Thanks: [Amjith])
-- Added shift-tab to select the previous entry in the completion menu. [Amjith]
-- Added `describe` and `desc` keywords.
+* Added `.read` command for reading scripts.
+* Added `.load` command for loading extension libraries. (Thanks: [Zhiming Wang])
+* Add support for using `?` as a placeholder in the favorite queries. (Thanks: [Amjith])
+* Added shift-tab to select the previous entry in the completion menu. [Amjith]
+* Added `describe` and `desc` keywords.
### Bug Fixes
-- Clear error message when directory does not exist. (Thanks: [Irina Truong])
+* Clear error message when directory does not exist. (Thanks: [Irina Truong])
## 1.0.0 - 2019-01-04
-- To new beginnings. :tada:
+* To new beginnings. :tada:
[Amjith]: https://blog.amjith.com
[chocolateboy]: https://github.com/chocolateboy
[Irina Truong]: https://github.com/j-bennet
-[Shawn Chapla]: https://github.com/shwnchpl
[Zhaolong Zhu]: https://github.com/zzl0
[Zhiming Wang]: https://github.com/zmwangx
-[Bjørnar Smestad]: https://brendesmestad.no
diff --git a/README.md b/README.md
index 649481d..81f0769 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# litecli
-[![Build Status](https://travis-ci.org/dbcli/litecli.svg?branch=master)](https://travis-ci.org/dbcli/litecli)
+[![GitHub Actions](https://github.com/dbcli/litecli/actions/workflows/ci.yml/badge.svg)](https://github.com/dbcli/litecli/actions/workflows/ci.yml "GitHub Actions")
[Docs](https://litecli.com)
@@ -24,6 +24,7 @@ The package is also available on Arch Linux through AUR in two versions: [litecl
```
$ yay -S litecli
```
+
or
```
diff --git a/litecli/__init__.py b/litecli/__init__.py
index 53d6006..19ee973 100644
--- a/litecli/__init__.py
+++ b/litecli/__init__.py
@@ -1 +1 @@
-__version__ = "1.12.3"
+__version__ = "1.12.4"
diff --git a/litecli/packages/special/dbcommands.py b/litecli/packages/special/dbcommands.py
index c0ed7e4..d779764 100644
--- a/litecli/packages/special/dbcommands.py
+++ b/litecli/packages/special/dbcommands.py
@@ -215,10 +215,9 @@ def load_extension(cur, arg, **_):
)
def describe(cur, arg, **_):
if arg:
- args = (arg,)
query = """
PRAGMA table_info({})
- """.format(args)
+ """.format(arg)
else:
return list_tables(cur)
diff --git a/tests/test_dbspecial.py b/tests/test_dbspecial.py
index d3c7c07..5c43fac 100644
--- a/tests/test_dbspecial.py
+++ b/tests/test_dbspecial.py
@@ -2,6 +2,7 @@ from litecli.packages.completion_engine import suggest_type
from test_completion_engine import sorted_dicts
from litecli.packages.special.utils import format_uptime
from litecli.packages.special.utils import check_if_sqlitedotcommand
+from utils import run, dbtest, assert_result_equal
def test_import_first_argument():
@@ -88,3 +89,21 @@ def test_check_if_sqlitedotcommand():
]
for command, expected_result in test_cases:
assert check_if_sqlitedotcommand(command) == expected_result
+
+
+@dbtest
+def test_special_d(executor):
+ run(executor, """create table tst_tbl1(a text)""")
+ results = run(executor, """\\d""")
+
+ assert_result_equal(results, headers=["name"], rows=[("tst_tbl1",)], status="")
+
+
+@dbtest
+def test_special_d_w_arg(executor):
+ run(executor, """create table tst_tbl1(a text)""")
+ results = run(executor, """\\d tst_tbl1""")
+
+ assert_result_equal(
+ results, headers=["cid", "name", "type", "notnull", "dflt_value", "pk"], rows=[(0, "a", "TEXT", 0, None, 0)], status=""
+ )
diff --git a/tests/test_sqlexecute.py b/tests/test_sqlexecute.py
index 0181b2c..2bdc84c 100644
--- a/tests/test_sqlexecute.py
+++ b/tests/test_sqlexecute.py
@@ -4,34 +4,10 @@ import os
import pytest
-from utils import run, dbtest, set_expanded_output, is_expanded_output
+from utils import run, dbtest, set_expanded_output, is_expanded_output, assert_result_equal
from sqlite3 import OperationalError, ProgrammingError
-def assert_result_equal(
- result,
- title=None,
- rows=None,
- headers=None,
- status=None,
- auto_status=True,
- assert_contains=False,
-):
- """Assert that an sqlexecute.run() result matches the expected values."""
- if status is None and auto_status and rows:
- status = "{} row{} in set".format(len(rows), "s" if len(rows) > 1 else "")
- fields = {"title": title, "rows": rows, "headers": headers, "status": status}
-
- if assert_contains:
- # Do a loose match on the results using the *in* operator.
- for key, field in fields.items():
- if field:
- assert field in result[0][key]
- else:
- # Do an exact match on the fields.
- assert result == [fields]
-
-
@dbtest
def test_conn(executor):
run(executor, """create table test(a text)""")
diff --git a/tests/utils.py b/tests/utils.py
index 4bacc94..79d59e6 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -88,3 +88,27 @@ def send_ctrl_c(wait_seconds):
ctrl_c_process = multiprocessing.Process(target=send_ctrl_c_to_pid, args=(os.getpid(), wait_seconds))
ctrl_c_process.start()
return ctrl_c_process
+
+
+def assert_result_equal(
+ result,
+ title=None,
+ rows=None,
+ headers=None,
+ status=None,
+ auto_status=True,
+ assert_contains=False,
+):
+ """Assert that an sqlexecute.run() result matches the expected values."""
+ if status is None and auto_status and rows:
+ status = "{} row{} in set".format(len(rows), "s" if len(rows) > 1 else "")
+ fields = {"title": title, "rows": rows, "headers": headers, "status": status}
+
+ if assert_contains:
+ # Do a loose match on the results using the *in* operator.
+ for key, field in fields.items():
+ if field:
+ assert field in result[0][key]
+ else:
+ # Do an exact match on the fields.
+ assert result == [fields]