Skip to content

fix(psql): disable help flag for psql to allow native flags - #650

Merged
FlorianBruniaux merged 1 commit into
rtk-ai:developfrom
tobwen:fix/psql-disable-help-flag
Mar 28, 2026
Merged

FlorianBruniaux merged 1 commit into
rtk-ai:developfrom
tobwen:fix/psql-disable-help-flag

Conversation

@tobwen

@tobwen tobwen commented Mar 17, 2026

Copy link
Copy Markdown
Contributor

Summary

psql flags like -h, -U, -d, -c were being interpreted as rtk options instead of being forwarded to psql.

Problem

When running rtk psql -h 192.168.106.72 -U dev -d dev -c "\dn", rtk's Clap parser consumed -h as the automatic help flag and displayed rtk's help text instead of executing the psql command.

Fix

Added #[command(disable_help_flag = true)] to the psql command variant in main.rs. This disables Clap's automatic -h and --help flags so that psql's own flags pass through correctly.

Users can still access psql's native help via rtk psql --help (which forwards to psql --help).

Test plan

  • cargo fmt --all --check
  • cargo clippy --all-targets
  • cargo test
  • rtk psql -h shows psql error (not rtk help)
  • rtk psql --help still works (shows psql help)
  • All existing psql_cmd tests pass

Related Issues

Fixes #613

@pszymkowiak

Copy link
Copy Markdown
Collaborator

Please retarget this PR to develop instead of master. We use develop as the integration branch — master is for releases only. You can change the base branch in the PR settings. Thanks!

@pszymkowiak pszymkowiak added the wrong-base PR targets master instead of develop label Mar 17, 2026
@tobwen
tobwen changed the base branch from master to develop March 18, 2026 06:49
@tobwen
tobwen force-pushed the fix/psql-disable-help-flag branch 2 times, most recently from d27262e to 7df4a2a Compare March 18, 2026 06:55
@tobwen

tobwen commented Mar 18, 2026

Copy link
Copy Markdown
Contributor Author

You can change the base branch in the PR settings.

Changed and rebased. Sorry.

Fixes rtk-ai#613 - psql flags like -h, -U, -d, -c were being interpreted
as rtk options instead of being forwarded to psql. By disabling the
automatic help flag, psql's own flags can pass through correctly.

Users can still access psql help via 'rtk psql --help'.
@tobwen
tobwen force-pushed the fix/psql-disable-help-flag branch from 7df4a2a to 41e0897 Compare March 20, 2026 06:51
@tobwen

tobwen commented Mar 20, 2026 •

Copy link
Copy Markdown
Contributor Author

Please don't get me wrong, but I need this information to determine whether it’s worth using my own fork instead of waiting for a release.

Could you give an indication of how long it usually takes for smaller, non-breaking changes to be reviewed and merged? I believe that such quick wins should always be prioritized over larger, more far-reaching changes.

There have been a few releases since I contributed this, and I noticed that the error badge hasn’t been updated yet. I completely understand that maintainers have limited time, but I just wanted to check in on the status.

I really enjoy contributing to this project and try to help by reporting issues and submitting PRs, so I’d appreciate any update when you have a moment. Thanks a lot for your work on this!

@CLAassistant

CLAassistant commented Mar 20, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@aeppling

Copy link
Copy Markdown
Contributor

Hey

We are cleaning up the codebase and improving the project structure for better onboarding. As part of this effort, PR #826 reorganizes src/ from a flat layout into subfolders.

No logic changes — only file moves and import path updates.

What you need to do

Rebase your branch on develop when receiving this comment:

git fetch origin && git rebase origin/develop

Git detects renames automatically. If you get import conflicts, update the paths:

use crate::git;        // now: use crate::cmds::git::git;
use crate::tracking;   // now: use crate::core::tracking;
use crate::config;     // now: use crate::core::config;
use crate::init;       // now: use crate::hooks::init;
use crate::gain;       // now: use crate::analytics::gain;

Need help rebasing? Tag @aeppling

@FlorianBruniaux
FlorianBruniaux merged commit 0a5d5d5 into rtk-ai:develop Mar 28, 2026
@tobwen

tobwen commented Mar 29, 2026

Copy link
Copy Markdown
Contributor Author
image

I can't sign this for unknown reason. But - for real - that's nothing anyone could ever claim a copyright on.

maxkulish added a commit to maxkulish/rtk that referenced this pull request Apr 14, 2026
Clap was intercepting -h as --help before psql received it,
breaking 'rtk psql -h hostname db'.

Upstream: v0.35.0 rtk-ai#650
thehoff pushed a commit to thehoff/contextcrawler that referenced this pull request May 14, 2026
Correct fix. disable_help_flag = true is the right pattern for passthrough commands — consistent with other commands in the codebase.
thehoff pushed a commit to thehoff/contextcrawler that referenced this pull request May 14, 2026
Correct fix. disable_help_flag = true is the right pattern for passthrough commands — consistent with other commands in the codebase.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wrong-base PR targets master instead of develop

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rtk interprets psql flags as its own options

5 participants