diff --git a/sqlite_utils/cli.py b/sqlite_utils/cli.py index 3d1c9a6..9090a23 100644 --- a/sqlite_utils/cli.py +++ b/sqlite_utils/cli.py @@ -386,6 +386,7 @@ def rows(ctx, path, dbtable, nl, arrays, csv, no_headers, table, fmt, json_cols) no_headers=no_headers, table=table, fmt=fmt, + json_cols=json_cols, ) diff --git a/tests/test_cli.py b/tests/test_cli.py index c8185b7..9f4f801 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -496,12 +496,13 @@ def test_query_json_with_json_cols(db_path): result = CliRunner().invoke( cli.cli, [db_path, "select id, name, friends from dogs", "--json-cols"] ) - assert ( - r""" + expected = r""" [{"id": 1, "name": "Cleo", "friends": [{"name": "Pancakes"}, {"name": "Bailey"}]}] """.strip() - == result.output.strip() - ) + assert expected == result.output.strip() + # Test rows command too + result_rows = CliRunner().invoke(cli.cli, ["rows", db_path, "dogs", "--json-cols"]) + assert expected == result_rows.output.strip() @pytest.mark.parametrize(