diff --git a/src/cli.rs b/src/cli.rs index 12a6357..9578a49 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -164,7 +164,17 @@ impl<'a> TryFrom> for AppConfig { ExportType::EPUB } }) - .is_inlining_images(arg_matches.is_present("inline-images")) + .is_inlining_images( + (if arg_matches.is_present("inline-images") { + if arg_matches.value_of("export") == Some("html") { + Ok(true) + } else { + Err(Error::WrongExportInliningImages) + } + } else { + Ok(false) + })?, + ) .try_init() } } diff --git a/src/errors.rs b/src/errors.rs index 8fbfeea..5b1cc25 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -156,6 +156,8 @@ pub enum CliError { OutputDirectoryNotExists, #[error("Unable to start logger!\n{0}")] LogError(#[from] LogError), - #[error("The --inline-toc can only be used exporting to epub")] + #[error("The --inline-toc flag can only be used when exporting to epub")] WrongExportInliningToC, + #[error("The --inline-images flag can only be used when exporting to html")] + WrongExportInliningImages, }