Skip to content

Improve CLI parameter validation errors #4903

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

Closed
masklinn opened this issue Jan 5, 2018 · 2 comments · Fixed by #4924
Closed

Improve CLI parameter validation errors #4903

masklinn opened this issue Jan 5, 2018 · 2 comments · Fixed by #4924

Comments

@masklinn
Copy link

masklinn commented Jan 5, 2018

These are minor QOL issues but following seeing https://www.reddit.com/r/rust/comments/7o3sgg/how_to_use_the_name_option_with_cargo/ I tried:

> cargo new --bin --name 01-init-instance
error: Invalid arguments.

Usage:
    cargo new [options] <path>
    cargo new -h | --help

The error message is unclear, the Usage section obliquely hints at the issue but the requirement of an FS path could be spelled out more clearly.

> cargo new --bin --name 01-init-instance a
error: Package names starting with a digit cannot be used as a crate name
use --name to override crate name

The error itself is correct, but the suggestion is not.

daschl added a commit to daschl/cargo that referenced this issue Jan 9, 2018
This changeset partially fixes rust-lang#4903 in that it doesn't suggest
using --name if its already being used (but the name is still
wrong).
@daschl
Copy link
Contributor

daschl commented Jan 9, 2018

@masklinn I created PR #4924 which I think does solve the second issue. The invalid arguments is done in a different spot, so that can be a separate PR i think.

bors added a commit that referenced this issue Jan 9, 2018
Do not suggest --name as a fix if its already used.

This changeset partially fixes #4903 in that it doesn't suggest
using --name if its already being used (but the name is still
wrong).
@bors bors closed this as completed in #4924 Jan 9, 2018
@sanmai-NL
Copy link

See also: #12766

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 a pull request may close this issue.

3 participants