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

Switch to pico-args #1768

Closed
matklad opened this issue Sep 5, 2019 · 9 comments · Fixed by #1806
Closed

Switch to pico-args #1768

matklad opened this issue Sep 5, 2019 · 9 comments · Fixed by #1806

Comments

@matklad
Copy link
Member

@matklad matklad commented Sep 5, 2019

We use clap, which is slow to compile. However, we only use it for internal tools, so it makes sense to switch to https://github.com/RazrFalcon/pico-args instead, which is much smaller.

@Geobert

This comment has been minimized.

Copy link
Contributor

@Geobert Geobert commented Sep 8, 2019

As RA uses subcommand, I believe this part will be manually handled? As a free param and then, according to which subcommand we have, we'll parse the relevant flags and error as needed?

@bjorn3

This comment has been minimized.

Copy link
Contributor

@bjorn3 bjorn3 commented Sep 8, 2019

Quoting pico-args readme:

Arguments are parsed in a linear order. From first to last.

:(

@matklad

This comment has been minimized.

Copy link
Member Author

@matklad matklad commented Sep 8, 2019

It’s fine to change subcommand to flags

@bjorn3

This comment has been minimized.

Copy link
Contributor

@bjorn3 bjorn3 commented Sep 8, 2019

It should also be possible to handle the subcommand part by matching on the first argument and then use Arguments::from_vec to pass the other arguments to pico_args.

@Geobert

This comment has been minimized.

Copy link
Contributor

@Geobert Geobert commented Sep 8, 2019

Another question: what is the CLI used for? I believe it's usefull enough to trigger the will to enhance compilation time and size of the CLI binary but I can't see why

@matklad

This comment has been minimized.

Copy link
Member Author

@matklad matklad commented Sep 9, 2019

Two crates have cli binaries: ra_tools and ra_cli

The ra_tools is basically what's plugged into aliases in .cargo/config, and is used for varios development tasks like codegeneration

ra_cli is used to provide simple command-line interface for rust-analyzer, and is used mainly to check performance during development.

In short, both uses are internal, so it makes sense to compromise on CLI convenience to have smaller compile times.

@Geobert

This comment has been minimized.

Copy link
Contributor

@Geobert Geobert commented Sep 9, 2019

Thanks! I've started the task, hope it will not be too long but I'm also on a task on cobalt so I'll do my best

@Geobert

This comment has been minimized.

Copy link
Contributor

@Geobert Geobert commented Sep 10, 2019

Hi again,

Do we need help message?

EDIT: or a Readme.md on ra_cli crate is enough?

@bjorn3

This comment has been minimized.

Copy link
Contributor

@bjorn3 bjorn3 commented Sep 10, 2019

A help message would be useful, as it is quicker to run ra_cli -h than to open Readme.md.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.