refactor(cli): move cmd_get/list/history/status/sync into commands/
This commit is contained in:
13
crates/relicario-cli/src/commands/sync.rs
Normal file
13
crates/relicario-cli/src/commands/sync.rs
Normal file
@@ -0,0 +1,13 @@
|
||||
//! `relicario sync` — pull --rebase + push.
|
||||
|
||||
use anyhow::Result;
|
||||
|
||||
pub fn cmd_sync() -> Result<()> {
|
||||
let root = crate::helpers::vault_dir()?;
|
||||
let pull = crate::helpers::git_command(&root, &["pull", "--rebase"]).status()?;
|
||||
if !pull.success() { anyhow::bail!("git pull --rebase failed"); }
|
||||
let push = crate::helpers::git_command(&root, &["push"]).status()?;
|
||||
if !push.success() { anyhow::bail!("git push failed"); }
|
||||
eprintln!("Sync complete.");
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user