Skip to content

Fix filename completions#368

Closed
bootandy wants to merge 3 commits into
masterfrom
cargo_update2
Closed

Fix filename completions#368
bootandy wants to merge 3 commits into
masterfrom
cargo_update2

Conversation

@bootandy
Copy link
Copy Markdown
Owner

I previously accidentally reverted a commit that @wickles made to fix the completion.

#359

wickles and others added 2 commits February 11, 2024 20:17
@wickles
Copy link
Copy Markdown
Contributor

wickles commented Feb 12, 2024

Maybe I'm wrong but I think there needs to be an adjustment to the completion generation in build.rs and src/cli.rs, or else clap will just revert this again with the next build.

Comment thread completions/_dust Outdated
'-V[Print version]' \
'--version[Print version]' \
'*::params:' \
'*:inputs:_files' \
Copy link
Copy Markdown
Contributor

@wickles wickles Feb 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not work. Remove the new line and replace the existing line with

'*::params:_files' \

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to make this change.

When I test tab completion it seems to work for me.

How would you recommend that I test this? & How do you know this is the right thing to do ?

Thanks

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just edit the existing file in your fpath and then start a new zsh session. When I try with both *:... lines added:

❯ dust <tab>
_arguments:comparguments:327: doubled rest argument definition: *:inputs:_files
_arguments:comparguments:327: doubled rest argument definition: *:inputs:_files
❯ dust 

compared with the one line as in my suggestion:

❯ dust <tab>
-- params --
Desktop/  Documents/ ...

@bootandy
Copy link
Copy Markdown
Owner Author

Maybe I'm wrong but I think there needs to be an adjustment to the completion generation in build.rs and src/cli.rs, or else clap will just revert this again with the next build.

You are right, going to rethink this.

@bootandy
Copy link
Copy Markdown
Owner Author

There's a lot of auto complete issues raised in clap-complete. https://github.com/clap-rs/clap/issues?page=2&q=is%3Aissue+is%3Aopen+completion

A (rather hacky) solution could be to add a comment saying 'do not commit this change' if clap rebuilds it. Although, ideally we want to fix the root problem which is either in clap-complete or my use of clap.

@bootandy bootandy closed this Feb 21, 2024
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