1
1
use crate :: core:: compiler:: { Compilation , CompileKind } ;
2
- use crate :: core:: { Shell , Workspace } ;
2
+ use crate :: core:: { shell :: Verbosity , Shell , Workspace } ;
3
3
use crate :: ops;
4
4
use crate :: util:: context:: { GlobalContext , PathAndArgs } ;
5
5
use crate :: util:: CargoResult ;
@@ -77,7 +77,7 @@ pub fn doc(ws: &Workspace<'_>, options: &DocOptions) -> CargoResult<()> {
77
77
) ?;
78
78
open_docs ( & path, & mut shell, config_browser, ws. gctx ( ) ) ?;
79
79
}
80
- } else {
80
+ } else if ws . gctx ( ) . shell ( ) . verbosity ( ) == Verbosity :: Verbose {
81
81
for name in & compilation. root_crate_names {
82
82
for kind in & options. compile_opts . build_config . requested_kinds {
83
83
let path =
@@ -92,6 +92,36 @@ pub fn doc(ws: &Workspace<'_>, options: &DocOptions) -> CargoResult<()> {
92
92
}
93
93
}
94
94
}
95
+ } else {
96
+ let mut output = compilation. root_crate_names . iter ( ) . flat_map ( |name| {
97
+ options
98
+ . compile_opts
99
+ . build_config
100
+ . requested_kinds
101
+ . iter ( )
102
+ . map ( |kind| path_by_output_format ( & compilation, kind, name, & options. output_format ) )
103
+ . filter ( |path| path. exists ( ) )
104
+ } ) ;
105
+ if let Some ( first_path) = output. next ( ) {
106
+ let remaining = output. count ( ) ;
107
+ let remaining = match remaining {
108
+ 0 => "" . to_owned ( ) ,
109
+ 1 => " and 1 other file" . to_owned ( ) ,
110
+ n => format ! ( " and {n} other files" ) ,
111
+ } ;
112
+
113
+ let mut shell = ws. gctx ( ) . shell ( ) ;
114
+ let link = shell. err_file_hyperlink ( & first_path) ;
115
+ shell. status (
116
+ "Generated" ,
117
+ format ! (
118
+ "{}{}{}{remaining}" ,
119
+ link. open( ) ,
120
+ first_path. display( ) ,
121
+ link. close( )
122
+ ) ,
123
+ ) ?;
124
+ }
95
125
}
96
126
97
127
Ok ( ( ) )
0 commit comments