Files
heartwood/radicle-tools/src/rad-clone.rs
T
Alexis Sellier 577b632056 Use Signer::try_sign in interactive contexts
In interactive (user) contexts, use `try_sign` instead of `sign`.

We also revisit the `Profile` by adding a `signer` method that can
fail, eg. if we couldn't connect to ssh-agent.

Finally, we replace `UnsafeSigner` with `MemorySigner`, which makes
use of `ssh::Keystore`.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-11-03 13:06:00 +01:00

27 lines
696 B
Rust

use std::env;
use std::path::Path;
use std::str::FromStr;
use radicle::identity::Id;
fn main() -> anyhow::Result<()> {
let cwd = Path::new(".").canonicalize()?;
let profile = radicle::Profile::load()?;
let signer = profile.signer()?;
if let Some(id) = env::args().nth(1) {
let id = Id::from_str(&id)?;
let node = radicle::node::connect(profile.node())?;
let repo = radicle::rad::clone(id, &cwd, &signer, &profile.storage, &node)?;
println!(
"ok: project {id} cloned into `{}`",
repo.workdir().unwrap().display()
);
} else {
anyhow::bail!("Error: a project id must be specified");
}
Ok(())
}