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

--{example,bin,bench,test} with no argument now lists all available targets #6505

Merged
merged 4 commits into from
Jan 7, 2019

Conversation

DamianX
Copy link
Contributor

@DamianX DamianX commented Jan 1, 2019

cargo run --bin
error: "--bin" takes one argument.
Available binaries:
    cargo

error: process didn't exit successfully: `target\debug\cargo.exe run --bin` (exit code: 101)

Previous PR: #5062
Closes #2548

Notes:

  • optional_opt is a weird name, can someone come up with a better one?
  • Should I call clap's usage() as well when printing the error message?

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@DamianX
Copy link
Contributor Author

DamianX commented Jan 1, 2019

It seems that targets are listed in alphabetical order on my windows machine (and on Travis' OS X VM, too, apparently) but they're not ordered on Linux. What to do here?

@ehuss
Copy link
Contributor

ehuss commented Jan 3, 2019

What to do here?

I think it should be fine to call targets.sort(); in get_available_targets.

@ehuss
Copy link
Contributor

ehuss commented Jan 3, 2019

One concern I have is that you now have to be careful to include the call to check_optional_opts... for every command. For example, this is missing the call for the doc command. Would it be possible to just check all the filter flags in compile_options? And I guess pass in Option<Workspace>? And I don't think check_optional_opts_example_and_bin is necessary, it can just call the "all" version since the other flags won't be present.

@DamianX
Copy link
Contributor Author

DamianX commented Jan 3, 2019

Thank you for that, it all makes a lot of sense.

Copy link
Contributor

@ehuss ehuss left a comment

Choose a reason for hiding this comment

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

Seems good. Not sure if anyone else wants to take a look.

@alexcrichton
Copy link
Member

@bors: r=ehuss

@bors
Copy link
Collaborator

bors commented Jan 7, 2019

📌 Commit a51759c has been approved by ehuss

@bors
Copy link
Collaborator

bors commented Jan 7, 2019

⌛ Testing commit a51759c with merge d92bd3a...

bors added a commit that referenced this pull request Jan 7, 2019
--{example,bin,bench,test} with no argument now lists all available targets

```
cargo run --bin
error: "--bin" takes one argument.
Available binaries:
    cargo

error: process didn't exit successfully: `target\debug\cargo.exe run --bin` (exit code: 101)
```

Previous PR: #5062
Closes #2548

Notes:
- `optional_opt` is a weird name, can someone come up with a better one?
- Should I call clap's `usage()` as well when printing the error message?
@bors
Copy link
Collaborator

bors commented Jan 7, 2019

☀️ Test successful - status-appveyor, status-travis
Approved by: ehuss
Pushing d92bd3a to master...

@bors bors merged commit a51759c into rust-lang:master Jan 7, 2019
bors added a commit to rust-lang/rust that referenced this pull request Jan 14, 2019
Update cargo

13 commits in 34320d212dca8cd27d06ce93c16c6151f46fcf2e..2b4a5f1f0bb6e13759e88ea9512527b0beba154f
2019-01-03 19:12:38 +0000 to 2019-01-12 04:13:12 +0000
- Add test for publish with [patch] + cleanup. (rust-lang/cargo#6544)
- Fix clippy warning (rust-lang/cargo#6546)
- Revert "Workaround by using yesterday's nightly" (rust-lang/cargo#6540)
- Adding feature-flags to `cargo publish` and `cargo package` (rust-lang/cargo#6453)
- Fix the Travis CI badge (rust-lang/cargo#6530)
- Add helpful text for Windows exceptions like Unix (rust-lang/cargo#6532)
- Report fix bugs to Rust instead of Cargo (rust-lang/cargo#6531)
- --{example,bin,bench,test} with no argument now lists all available targets (rust-lang/cargo#6505)
- Rebuild on mid build file modification (rust-lang/cargo#6484)
- Derive Clone for TomlDependency (rust-lang/cargo#6527)
- publish: rework the crates.io detection logic. (rust-lang/cargo#6525)
- avoid duplicates in ignore files (rust-lang/cargo#6521)
- Rustflags in metadata (rust-lang/cargo#6503)

r? @alexcrichton
@ehuss ehuss added this to the 1.33.0 milestone Feb 6, 2022
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.

cargo run --example should print available examples
5 participants