diff options
Diffstat (limited to 'src/bin/sp-extract.rs')
-rw-r--r-- | src/bin/sp-extract.rs | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/src/bin/sp-extract.rs b/src/bin/sp-extract.rs index 9be159f..86bc15a 100644 --- a/src/bin/sp-extract.rs +++ b/src/bin/sp-extract.rs @@ -4,7 +4,7 @@ use std::path::PathBuf; use structopt::StructOpt; -use subplot::{DataFile, Document, Style, SubplotError}; +use subplot::Style; mod cli; @@ -29,19 +29,10 @@ fn main() -> Result<()> { let doc = cli::load_document(&opt.filename, Style::default())?; for filename in opt.embedded { - let file = get_embedded(&doc, &filename)?; + let file = cli::extract_file(&doc, &filename)?; let output = opt.directory.join(filename); write(output, file.contents())?; } Ok(()) } - -fn get_embedded<'a>(doc: &'a Document, filename: &str) -> Result<&'a DataFile> { - for file in doc.files() { - if file.filename() == filename { - return Ok(file); - } - } - Err(SubplotError::EmbeddedFileNotFound(filename.to_owned()).into()) -} |