mirror of
https://seed.radicle.dev/rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5.git
synced 2026-11-21 18:40:39 +08:00
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>
27 lines
696 B
Rust
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(())
|
|
}
|