You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 8e4aef4
Browse filesBrowse the repository at this point in the historyBrowse files
authored
Add support for -y/--yes flag to bypass confirmation prompts (#1544)
* Add support for -y/--yes flag to bypass confirmation prompts
This commit adds support for the -y/--yes option to pgcli, allowing users
to bypass destructive command confirmation prompts. This is particularly
useful for automated scripts and CI/CD pipelines.
Features:
- Single flag to skip all destructive confirmations: pgcli -y
- Long form: pgcli --yes
- Useful for automated environments
- Maintains safety by default (flag must be explicitly set)
- Does not override transaction requirements
When the flag is set:
- Destructive commands execute without prompting
- Transaction requirements still apply
- Error handling remains the same
Comprehensive unit tests included to verify:
- Flag initialization
- Confirmation bypass behavior
- Normal confirmation flow without flag
Made with ❤️ and 🤖 Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
* Suppress 'Your call!' message when using --yes flag
When using the --yes flag to auto-confirm destructive commands,
pgcli should not display the "Your call!" message since no user
interaction occurred. This message is now only shown when the user
manually confirms the destructive warning prompt.
Made with ❤️ and 🤖 Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
* Pass force_destructive into confirm_destructive_query
Address review feedback: instead of checking self.force_destructive at both
call sites, confirm_destructive_query now takes a `force` parameter and owns
the whole 'should we proceed?' decision.
Behaviour is unchanged: non-destructive returns None, force returns True,
a non-tty stdin returns None (no prompt), otherwise the user is prompted.
The parameter defaults to False, so existing callers are unaffected.
* Assert the user is not prompted, not which helper is called
test_force_destructive_skips_confirmation asserted that
confirm_destructive_query was never called with -y. Now that the helper takes
the force parameter it IS called and decides internally not to prompt, so the
old assertion encoded the previous structure rather than the behaviour.
It now patches prompt_utils.confirm and asserts the user is never prompted,
which is the actual guarantee -y makes.
---------
Co-authored-by: DiegoDAF <DiegoDAF@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Diego - pgDBA <151667121+diego-feito-stori@users.noreply.github.com>
Co-authored-by: Irina Truong <637013+j-bennet@users.noreply.github.com>
0 commit comments