Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make history file configurable #207

Merged
merged 2 commits into from
Feb 17, 2025
Merged

Conversation

dhashe
Copy link

@dhashe dhashe commented Feb 16, 2025

Description

Add a history_file option to the config file. Matches the behavior of
pgcli and mssql-cli.

Fixes #206

Manual testing

Verify that the default history location still works:

$ litecli :memory:

LiteCli: 1.14.3.dev1+geedfef6 (SQLite: 3.37.2)
GitHub: https://github.com/dbcli/litecli
:memory:> select 42;
+----+
| 42 |
+----+
| 42 |
+----+
1 row in set
Time: 0.015s
:memory:>
Goodbye!

$ tail -2 ~/.config/litecli/history
# 2025-02-16 16:21:26.052905
+select 42;

Check that custom history locations work and will be created if not present:

$ stat ~/.my_nonstandard_litecli_history_file
stat: cannot statx '/home/dhashe/.my_nonstandard_litecli_history_file': No such file or directory

$ sed -i '2a history_file = ~/.my_nonstandard_litecli_history_file' ~/.config/litecli/config

$ litecli :memory:

LiteCli: 1.14.3.dev1+geedfef6 (SQLite: 3.37.2)
GitHub: https://github.com/dbcli/litecli
:memory:> select 43;
+----+
| 43 |
+----+
| 43 |
+----+
1 row in set
Time: 0.017s
:memory:>
Goodbye!

$ cat ~/.my_nonstandard_litecli_history_file

# 2025-02-16 16:31:02.120200
+select 43;

Checklist

  • I've added this contribution to the CHANGELOG.md file.

David Hashe added 2 commits February 16, 2025 16:17
This matches the behavior of pgcli and mssql-cli.
@amjith
Copy link
Member

amjith commented Feb 17, 2025

Thank you!

@amjith amjith merged commit b0a41f5 into dbcli:main Feb 17, 2025
7 checks passed
@dhashe dhashe deleted the history-file-config branch February 17, 2025 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

History file location should be configurable
2 participants