Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 57 additions & 0 deletions furrow-cli/src/archive.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
use clap::Subcommand;
use std::path::PathBuf;
#[derive(Subcommand)]
pub enum Archive {
Capture {
#[arg(long)]
store: PathBuf,
#[arg(long)]
workspace: PathBuf,
},
Restore {
#[arg(long)]
store: PathBuf,
#[arg(long)]
snapshot: String,
#[arg(long)]
destination: PathBuf,
},
VerifyRemainder {
#[arg(long)]
store: PathBuf,
#[arg(long)]
snapshot: String,
#[arg(long)]
workspace: PathBuf,
},
Verify {
#[arg(long)]
store: PathBuf,
#[arg(long)]
snapshot: String,
#[arg(long)]
workspace: PathBuf,
},
}
pub fn run(command: Archive) -> anyhow::Result<()> {
let receipt = match command {
Archive::Capture { store, workspace } => furrow::archive::capture(&store, &workspace)?,
Archive::Restore {
store,
snapshot,
destination,
} => furrow::archive::restore(&store, &snapshot, &destination)?,
Archive::VerifyRemainder {
store,
snapshot,
workspace,
} => furrow::archive::verify_remainder(&store, &snapshot, &workspace)?,
Archive::Verify {
store,
snapshot,
workspace,
} => furrow::archive::verify(&store, &snapshot, &workspace)?,
};
println!("{}", serde_json::to_string(&receipt)?);
Ok(())
}
9 changes: 9 additions & 0 deletions furrow-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ use std::fs;
use std::io::{self, IsTerminal, Read, Write};
use std::path::PathBuf;

#[cfg(unix)]
mod archive;
mod exchange;

#[derive(Parser)]
Expand All @@ -29,6 +31,11 @@ struct Cli {

#[derive(Subcommand)]
enum Command {
#[cfg(unix)]
Archive {
#[command(subcommand)]
command: archive::Archive,
},
/// List every capture candidate before screening it, with a token for turn-end.
CapturePlan {
#[command(flatten)]
Expand Down Expand Up @@ -585,6 +592,8 @@ fn main() -> anyhow::Result<()> {
std::env::set_var("FURROW_TIMELINE", timeline);
}
match cli.command {
#[cfg(unix)]
Command::Archive { command } => archive::run(command)?,
Command::CapturePlan { seal } => {
let options = seal.options()?;
let repository = FurrowRepository::attach_timeline_in(
Expand Down
Loading
Loading