mirror of
https://github.com/Noratrieb/fix-und-fertig.git
synced 2026-01-14 18:55:04 +01:00
db
This commit is contained in:
parent
d964157bfc
commit
49c9e3aa4c
6 changed files with 130 additions and 17 deletions
|
|
@ -1,12 +1,21 @@
|
|||
//! `fuf db` commands.
|
||||
|
||||
use color_eyre::Result;
|
||||
use std::{path::Path};
|
||||
use color_eyre::{eyre::Context, Result};
|
||||
use std::path::PathBuf;
|
||||
|
||||
use crate::{cli::utils, workspace::Workspace};
|
||||
|
||||
pub fn save_file(workspace: &Workspace, path: &Path) -> Result<()> {
|
||||
let file = utils::read_file(path)?;
|
||||
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(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue