pgcli icon indicating copy to clipboard operation
pgcli copied to clipboard

Add a configuration option to execute commands on startup.

Open mlefebvre opened this issue 4 years ago • 2 comments

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 AUTHORS file (or it's already there).
  • [x] I installed pre-commit hooks (pip install pre-commit && pre-commit install), and ran black on my code.
  • [x] Please squash merge this pull request (uncheck if you'd like us to merge as multiple commits)

mlefebvre avatar Nov 09 '21 14:11 mlefebvre

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.

codecov-commenter avatar Nov 19 '21 17:11 codecov-commenter

Hey @mlefebvre, do you need some help with this PR? This seems like a useful feature, would be nice to get it in.

j-bennet avatar Jun 10 '22 16:06 j-bennet

Hi @mlefebvre, I tested your PR, things work fine. If you rebase on main, I'll merge this without a test.

j-bennet avatar Sep 02 '22 21:09 j-bennet

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 avatar Sep 13 '22 22:09 mlefebvre

@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?

j-bennet avatar Sep 16 '22 20:09 j-bennet