summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlaixintao <laixintaoo@gmail.com>2020-10-15 19:06:35 +0800
committerlaixintao <laixintaoo@gmail.com>2020-10-15 19:06:35 +0800
commit19ed8b28aa673949f2498aeec2debfebe41f8874 (patch)
treef4b0cf6961369642e24ba39ebb3555d993210a25
parent7626d9a5f27a221d87f31dcb5bb8fc12024f6c58 (diff)
doc: add history_file per dsn config, and --history option.
-rw-r--r--pgcli/main.py4
-rw-r--r--pgcli/pgclirc8
2 files changed, 11 insertions, 1 deletions
diff --git a/pgcli/main.py b/pgcli/main.py
index b1468985..e949d24d 100644
--- a/pgcli/main.py
+++ b/pgcli/main.py
@@ -1194,6 +1194,9 @@ class PGCli(object):
@click.option(
"--warn/--no-warn", default=None, help="Warn before running a destructive query."
)
+@click.option(
+ "--history", default=None, help="Specify history file location."
+)
@click.argument("dbname", default=lambda: None, envvar="PGDATABASE", nargs=1)
@click.argument("username", default=lambda: None, envvar="PGUSER", nargs=1)
def cli(
@@ -1217,6 +1220,7 @@ def cli(
auto_vertical_output,
list_dsn,
warn,
+ history,
):
if version:
print("Version:", __version__)
diff --git a/pgcli/pgclirc b/pgcli/pgclirc
index e97afdab..60b79a20 100644
--- a/pgcli/pgclirc
+++ b/pgcli/pgclirc
@@ -58,7 +58,8 @@ generate_casing_file = False
# Casing of column headers based on the casing_file described above
case_column_headers = True
-# history_file location.
+# default history_file location. You can also set history file location for
+# specific database. see [dsn_history_file] section.
# In Unix/Linux: ~/.config/pgcli/history
# In Windows: %USERPROFILE%\AppData\Local\dbcli\pgcli\history
# %USERPROFILE% is typically C:\Users\{username}
@@ -187,6 +188,11 @@ output.null = "#808080"
[alias_dsn]
# example_dsn = postgresql://[user[:password]@][netloc][:port][/dbname]
+# Specify sperate history file for alias_dsn.
+# If not set, will use history_file settings.
+[dsn_history_file]
+# example_dsn = ~/.config/pgcli/example_dsn.history
+
# Format for number representation
# for decimal "d" - 12345678, ",d" - 12,345,678
# for float "g" - 123456.78, ",g" - 123,456.78