Add a configuration option to execute commands on startup.
Description
Related issue: #247
I needed a way to execute commands on startup (like SET default_transaction_read_only = on when connecting on a production server), so I added a new startup_command configuration option.
Checklist
- [x] I've added this contribution to the
changelog.rst. - [x I've added my name to the
AUTHORSfile (or it's already there). - [x] I installed pre-commit hooks (
pip install pre-commit && pre-commit install), and ranblackon my code. - [x] Please squash merge this pull request (uncheck if you'd like us to merge as multiple commits)
Codecov Report
Base: 84.15% // Head: 79.40% // Decreases project coverage by -4.74% :warning:
Coverage data is based on head (
31879f9) compared to base (6884c29). Patch coverage: 42.20% of modified lines in pull request are covered.
Additional details and impacted files
@@ Coverage Diff @@
## main #1294 +/- ##
==========================================
- Coverage 84.15% 79.40% -4.75%
==========================================
Files 21 24 +3
Lines 2720 2904 +184
==========================================
+ Hits 2289 2306 +17
- Misses 431 598 +167
| Impacted Files | Coverage Δ | |
|---|---|---|
| pgcli/packages/parseutils/tables.py | 97.67% <ø> (ø) |
|
| pgcli/packages/sqlcompletion.py | 97.67% <ø> (ø) |
|
| pgcli/pgtoolbar.py | 31.57% <0.00%> (+0.15%) |
:arrow_up: |
| pgcli/pyev.py | 15.38% <15.38%> (ø) |
|
| pgcli/explain_output_formatter.py | 46.15% <46.15%> (ø) |
|
| pgcli/key_bindings.py | 52.94% <50.00%> (-0.19%) |
:arrow_down: |
| pgcli/main.py | 78.44% <86.66%> (-0.09%) |
:arrow_down: |
| pgcli/pgexecute.py | 83.22% <87.14%> (+2.86%) |
:arrow_up: |
| pgcli/auth.py | 91.30% <91.30%> (ø) |
|
| pgcli/__init__.py | 100.00% <100.00%> (ø) |
|
| ... and 6 more |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
Hey @mlefebvre, do you need some help with this PR? This seems like a useful feature, would be nice to get it in.
Hi @mlefebvre, I tested your PR, things work fine. If you rebase on main, I'll merge this without a test.
Sorry @j-bennet , I had completely forgotten about this!
We found a different way to achieve what we wanted to do, so we didn't need the feature anymore.
@mlefebvre
Thank you for getting back to me. If you don't intend to continue working on it, I'll close the PR.
Can you share how you solved this, so other users can benefit from your solution?