@@ -81,9 +81,16 @@ pub struct CmdOptions {
8181 intralinks_strip_links : bool ,
8282 force : bool ,
8383 readme_path : Option < PathBuf > ,
84+ manifest_path : Option < PathBuf > ,
8485 heading_base_level : Option < u8 > ,
8586}
8687
88+ impl CmdOptions {
89+ pub fn manifest_path ( & self ) -> Option < & Path > {
90+ self . manifest_path . as_deref ( )
91+ }
92+ }
93+
8794fn get_cmd_args ( ) -> Vec < OsString > {
8895 let mut args: Vec < OsString > = std:: env:: args_os ( ) . collect ( ) ;
8996 let subcommand: & str = {
@@ -127,7 +134,13 @@ pub fn cmd_options() -> CmdOptions {
127134 Arg :: new ( "readme-path" )
128135 . long ( "readme-path" )
129136 . short ( 'r' )
130- . help ( "README file path to use (overrides of what is specified in the project `Cargo.toml`)" )
137+ . help ( "README file path to use (overrides what is specified in the project `Cargo.toml`)" )
138+ . value_parser ( value_parser ! ( PathBuf ) ) ,
139+ )
140+ . arg (
141+ Arg :: new ( "manifest-path" )
142+ . long ( "manifest-path" )
143+ . help ( "path to `Cargo.toml`" )
131144 . value_parser ( value_parser ! ( PathBuf ) ) ,
132145 )
133146 . arg (
@@ -178,6 +191,7 @@ pub fn cmd_options() -> CmdOptions {
178191 let entrypoint = cmd_opts. get_one :: < EntrypointOpt > ( "entrypoint" ) . cloned ( ) ;
179192
180193 let readme_path = cmd_opts. get_one :: < PathBuf > ( "readme-path" ) . cloned ( ) ;
194+ let manifest_path = cmd_opts. get_one :: < PathBuf > ( "manifest-path" ) . cloned ( ) ;
181195
182196 let heading_base_level = cmd_opts. get_one :: < u8 > ( "heading-base-level" ) . copied ( ) ;
183197
@@ -190,6 +204,7 @@ pub fn cmd_options() -> CmdOptions {
190204 intralinks_strip_links : cmd_opts. get_flag ( "intralinks-strip-links" ) ,
191205 force : cmd_opts. get_flag ( "force" ) ,
192206 readme_path,
207+ manifest_path,
193208 heading_base_level,
194209 }
195210}
@@ -314,6 +329,7 @@ pub struct Options {
314329 pub no_fail_on_warnings : bool ,
315330 pub force : bool ,
316331 pub readme_path : Option < PathBuf > ,
332+ pub manifest_path : Option < PathBuf > ,
317333 pub intralinks : Option < IntralinksConfig > ,
318334 pub heading_base_level : Option < u8 > ,
319335}
@@ -343,6 +359,7 @@ pub fn merge_options(
343359 readme_path : cmd_options
344360 . readme_path
345361 . or_else ( || config_file_options. as_mut ( ) . and_then ( |c| c. readme_path . take ( ) ) ) ,
362+ manifest_path : cmd_options. manifest_path ,
346363 intralinks : Some ( IntralinksConfig {
347364 docs_rs : IntralinksDocsRsConfig {
348365 docs_rs_base_url : config_file_options
@@ -425,6 +442,7 @@ mod tests {
425442 intralinks_strip_links : true ,
426443 force : true ,
427444 readme_path : Some ( PathBuf :: from ( "rEaDmE.md" ) ) ,
445+ manifest_path : Some ( PathBuf :: from ( "foo/Cargo.toml" ) ) ,
428446 heading_base_level : Some ( 4 ) ,
429447 } ;
430448 let config_file_options = ConfigFileOptions {
@@ -452,6 +470,7 @@ mod tests {
452470 no_fail_on_warnings : true ,
453471 force : true ,
454472 readme_path : Some ( PathBuf :: from ( "rEaDmE.md" ) ) ,
473+ manifest_path : Some ( PathBuf :: from ( "foo/Cargo.toml" ) ) ,
455474 intralinks : Some ( IntralinksConfig {
456475 docs_rs : IntralinksDocsRsConfig {
457476 docs_rs_base_url : Some ( "https://internaldocs.rs" . to_owned ( ) ) ,
0 commit comments