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

Projects
None yet
5 participants
@DamianX
Copy link
Contributor

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

This comment has been minimized.

Copy link

rust-highfive commented Jan 1, 2019

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.

Fix failing tests: cargo install may not be called from a workspace, …
…replaced max_values -> number_of_values
@DamianX

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Contributor Author

DamianX commented Jan 3, 2019

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

@ehuss

ehuss approved these changes Jan 4, 2019

Copy link
Contributor

ehuss left a comment

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

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Jan 7, 2019

@bors: r=ehuss

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 7, 2019

📌 Commit a51759c has been approved by ehuss

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 7, 2019

⌛️ Testing commit a51759c with merge d92bd3a...

bors added a commit that referenced this pull request Jan 7, 2019

Auto merge of #6505 - DamianX:print_examples, r=ehuss
--{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

This comment has been minimized.

Copy link
Contributor

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

3 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details

@ehuss ehuss referenced this pull request Jan 12, 2019

Merged

Update cargo #57559

bors added a commit to rust-lang/rust that referenced this pull request Jan 14, 2019

Auto merge of #57559 - ehuss:update-cargo, r=alexcrichton
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment