-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
fix(doc): Collapse down Generated statuses without --verbose #13557
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
use crate::core::compiler::{Compilation, CompileKind}; | ||
use crate::core::{Shell, Workspace}; | ||
use crate::core::{shell::Verbosity, Shell, Workspace}; | ||
use crate::ops; | ||
use crate::util::context::{GlobalContext, PathAndArgs}; | ||
use crate::util::CargoResult; | ||
|
@@ -77,7 +77,7 @@ pub fn doc(ws: &Workspace<'_>, options: &DocOptions) -> CargoResult<()> { | |
)?; | ||
open_docs(&path, &mut shell, config_browser, ws.gctx())?; | ||
} | ||
} else { | ||
} else if ws.gctx().shell().verbosity() == Verbosity::Verbose { | ||
for name in &compilation.root_crate_names { | ||
for kind in &options.compile_opts.build_config.requested_kinds { | ||
let path = | ||
|
@@ -92,6 +92,36 @@ pub fn doc(ws: &Workspace<'_>, options: &DocOptions) -> CargoResult<()> { | |
} | ||
} | ||
} | ||
} else { | ||
let mut output = compilation.root_crate_names.iter().flat_map(|name| { | ||
options | ||
.compile_opts | ||
.build_config | ||
.requested_kinds | ||
.iter() | ||
.map(|kind| path_by_output_format(&compilation, kind, name, &options.output_format)) | ||
.filter(|path| path.exists()) | ||
}); | ||
if let Some(first_path) = output.next() { | ||
let remaining = output.count(); | ||
let remaining = match remaining { | ||
0 => "".to_owned(), | ||
1 => " and 1 other file".to_owned(), | ||
n => format!(" and {n} other files"), | ||
}; | ||
|
||
let mut shell = ws.gctx().shell(); | ||
let link = shell.err_file_hyperlink(&first_path); | ||
shell.status( | ||
"Generated", | ||
format!( | ||
"{}{}{}{remaining}", | ||
link.open(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please implement the fancy alternate form for links 😁. |
||
first_path.display(), | ||
link.close() | ||
), | ||
)?; | ||
} | ||
} | ||
|
||
Ok(()) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same behavior for
cargo test --no-run
?I believe people are doing evil things like parsing the executable paths…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a lot of problems with
cargo test
and I'd like to look at all of them holistically