File tree Expand file tree Collapse file tree 4 files changed +10
-0
lines changed
Expand file tree Collapse file tree 4 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -122,6 +122,7 @@ Contributors:
122122 * Daniele Varrazzo
123123 * Daniel Kukula (dkuku)
124124 * Kian-Meng Ang (kianmeng)
125+ * Mathieu Gascon-Lefebvre (mlefebvre)
125126
126127Creator:
127128--------
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ Features:
4949
5050* Add `max_field_width ` setting to config, to enable more control over field truncation ([related issue](https://github.com/dbcli/pgcli/issues/1250)).
5151* Re-run last query via bare `\watch `. (Thanks: `Saif Hakim `_)
52+ * Add a configuration option to execute commands on startup ([related issue](https://github.com/dbcli/pgcli/issues/247)).
5253
5354Bug fixes:
5455----------
Original file line number Diff line number Diff line change @@ -241,6 +241,7 @@ def __init__(
241241 self .float_format = c ["data_formats" ]["float" ]
242242 auth .keyring_initialize (c ["main" ].as_bool ("keyring" ), logger = self .logger )
243243 self .show_bottom_toolbar = c ["main" ].as_bool ("show_bottom_toolbar" )
244+ self .startup_command = c ["main" ]["startup_command" ]
244245
245246 self .pgspecial .pset_pager (
246247 self .config ["main" ].as_bool ("enable_pager" ) and "on" or "off"
@@ -778,6 +779,10 @@ def run_cli(self):
778779 print ("Home: http://pgcli.com" )
779780
780781 try :
782+ if self .startup_command :
783+ print (f"Executing startup command: { self .startup_command } " )
784+ self .handle_watch_command (self .startup_command )
785+
781786 while True :
782787 try :
783788 text = self .prompt_app .prompt ()
Original file line number Diff line number Diff line change @@ -158,6 +158,9 @@ enable_pager = True
158158# Use keyring to automatically save and load password in a secure manner
159159keyring = True
160160
161+ # Command to run at startup. Multiple commands can be specified if separated by a semicolon.
162+ startup_command = ' '
163+
161164# Custom colors for the completion menu, toolbar, etc.
162165[colors]
163166completion-menu.completion.current = ' bg:#ffffff #000000'
You can’t perform that action at this time.
0 commit comments