Skip to content

Conversation

@mernen
Copy link
Contributor

@mernen mernen commented Apr 27, 2025

This is a fix for #5980.

Tested with the same POC app, app-name --path sr<TAB> now completes to src/ with no trailing space, and <TAB> again completes to src/main.rs (with trailing space), as expected.

Also tested with jj.

@mernen mernen changed the title fix(complete): restore nospace in bash when reply ends in =/: fix(complete): restore nospace in bash when reply ends in =/: Apr 27, 2025
@epage
Copy link
Member

epage commented Apr 28, 2025

Tested with the same POC app, app-name --path sr now completes to src/ with no trailing space, and again completes to src/main.rs (with trailing space), as expected.

We have end-to-end tests for bash completions. Would you be able to reproduce this in that scenario so we can have a test for this?

Preferrably, we split the PR up into two commits

  1. Add the test, showing the current broken behavior
  2. Fix the behavior and update the test

@mernen
Copy link
Contributor Author

mernen commented Apr 28, 2025

Apologies, I hadn't noticed the project already has testing infrastructure for simulating a terminal! I've now included a proper test. Also, I see this is very similar to an existing test for issue #5239, except this one is for dynamic completion.

@epage
Copy link
Member

epage commented Apr 28, 2025

Thanks!

@epage epage merged commit 54947a1 into clap-rs:master Apr 28, 2025
25 checks passed
@mernen mernen deleted the fix-bash-clap-complete-space branch May 11, 2025 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants