fix-und-fertig/src/cli/commands/db.rs
2024-01-31 21:44:14 +01:00

21 lines
512 B
Rust

//! `fuf db` commands.
use color_eyre::{eyre::Context, Result};
use std::path::PathBuf;
use crate::{cli::utils, workspace::Workspace};
pub fn save_file(workspace: &Workspace, paths: &[PathBuf]) -> Result<()> {
for path in paths {
let file = utils::read_file(path)?;
let address = workspace
.db
.save_file(&file)
.wrap_err("saving file to database")?;
utils::print(format_args!("{address}\n")).wrap_err("printing output")?;
}
Ok(())
}