mirror of
https://github.com/Noratrieb/fix-und-fertig.git
synced 2026-01-14 10:45:05 +01:00
21 lines
512 B
Rust
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(())
|
|
}
|