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 @@ -118,6 +118,7 @@ Contributors:
118118 * Miroslav Šedivý (eumiro)
119119 * Eric R Young (ERYoung11)
120120 * Paweł Sacawa (psacawa)
121+ * Mathieu Gascon-Lefebvre (mlefebvre)
121122
122123Creator:
123124--------
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ Features:
66
77* Add `max_field_width ` setting to config, to enable more control over field truncation ([related issue](https://github.com/dbcli/pgcli/issues/1250)).
88* Re-run last query via bare `\watch `. (Thanks: `Saif Hakim `_)
9+ * Add a configuration option to execute commands on startup ([related issue](https://github.com/dbcli/pgcli/issues/247)).
910
1011Bug fixes:
1112----------
Original file line number Diff line number Diff line change @@ -237,6 +237,7 @@ def __init__(
237237 self .float_format = c ["data_formats" ]["float" ]
238238 self .initialize_keyring ()
239239 self .show_bottom_toolbar = c ["main" ].as_bool ("show_bottom_toolbar" )
240+ self .startup_command = c ["main" ]["startup_command" ]
240241
241242 self .pgspecial .pset_pager (
242243 self .config ["main" ].as_bool ("enable_pager" ) and "on" or "off"
@@ -758,6 +759,10 @@ def run_cli(self):
758759 print ("Home: http://pgcli.com" )
759760
760761 try :
762+ if self .startup_command :
763+ print (f"Executing startup command: { self .startup_command } " )
764+ self .handle_watch_command (self .startup_command )
765+
761766 while True :
762767 try :
763768 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