Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[breaking change] Rework Command Arguments Parsing using Rust Clap Crate #981

Closed
liuchengxu opened this issue Jun 22, 2023 · 0 comments · Fixed by #982
Closed

[breaking change] Rework Command Arguments Parsing using Rust Clap Crate #981

liuchengxu opened this issue Jun 22, 2023 · 0 comments · Fixed by #982

Comments

@liuchengxu
Copy link
Owner

liuchengxu commented Jun 22, 2023

I am proposing a significant change to vim-clap's command argument parsing mechanism. Currently, argument parsing is done in Vimscript, which is brittle and inconsistent. I believe there are significant benefits to utilizing the Rust clap crate.

The clap crate in Rust is a sophisticated command-line argument parser that offers a wide array of features. It includes helpful error messages, argument validation, and easily manageable subcommands, among other utilities. By leveraging these features, we can greatly enhance the robustness and usability of :Clap interface.

However, it's essential to note that this modification would introduce breaking changes for users. The usage of some providers will be changed as we adopt the argument conventions and validation used by the clap crate. Consequently, users would need to update their configuration to reflect these changes.

I strongly believe that the improvements in reliability, user experience, and maintainability would outweigh the temporary inconvenience caused by the necessary adjustments.

As always, I value your thoughts and feedback. I am open to further discussions on this matter before proceeding with the implementation.

I expect these changes:

  • No more ++arg and +arg.
    • Clap grep ++query=foo => Clap grep --query=foo
    • Clap grep ~/.vim/plugged => Clap grep --path ~/.vim/plugged
    • Clap files +name-only => Clap files --name-only
    • Clap files ~ => Clap files --path=~

It's technically possible to support showing the help info with :Clap files --help and add the arguments for every provider in a nice way, but I don't have the bandwidth to implement it properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant