1
1
use std:: env;
2
2
3
3
use cargo:: core:: Workspace ;
4
- use cargo:: ops:: { self , CompileOptions , MessageFormat } ;
4
+ use cargo:: ops:: { self , CompileOptions , MessageFormat , Packages } ;
5
5
use cargo:: util:: { CliResult , Config } ;
6
6
use cargo:: util:: important_paths:: find_root_manifest_for_wd;
7
7
13
13
14
14
Options:
15
15
-h, --help Print this message
16
- -p SPEC, --package SPEC ... Package to check
16
+ -p SPEC, --package SPEC ... Package(s) to check
17
+ --all Check all packages in the workspace
17
18
-j N, --jobs N Number of parallel jobs, defaults to # of CPUs
18
19
--lib Check only this package's library
19
20
--bin NAME Check only the specified binary
@@ -64,6 +65,7 @@ pub struct Options {
64
65
flag_bench : Vec < String > ,
65
66
flag_locked : bool ,
66
67
flag_frozen : bool ,
68
+ flag_all : bool ,
67
69
}
68
70
69
71
pub fn execute ( options : Options , config : & Config ) -> CliResult {
@@ -79,14 +81,20 @@ pub fn execute(options: Options, config: &Config) -> CliResult {
79
81
let root = find_root_manifest_for_wd ( options. flag_manifest_path , config. cwd ( ) ) ?;
80
82
let ws = Workspace :: new ( & root, config) ?;
81
83
84
+ let spec = if options. flag_all {
85
+ Packages :: All
86
+ } else {
87
+ Packages :: Packages ( & options. flag_package )
88
+ } ;
89
+
82
90
let opts = CompileOptions {
83
91
config : config,
84
92
jobs : options. flag_jobs ,
85
93
target : options. flag_target . as_ref ( ) . map ( |t| & t[ ..] ) ,
86
94
features : & options. flag_features ,
87
95
all_features : options. flag_all_features ,
88
96
no_default_features : options. flag_no_default_features ,
89
- spec : ops :: Packages :: Packages ( & options . flag_package ) ,
97
+ spec : spec ,
90
98
mode : ops:: CompileMode :: Check ,
91
99
release : options. flag_release ,
92
100
filter : ops:: CompileFilter :: new ( options. flag_lib ,
0 commit comments