cli: Reorder method arguments
Reorder the method arguments in the commands to make them consistent.
This commit is contained in:
parent
f2d4b9acc2
commit
3af53626f0
|
|
@ -61,7 +61,7 @@ impl Args for Options {
|
||||||
|
|
||||||
pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
||||||
match ctx.profile() {
|
match ctx.profile() {
|
||||||
Ok(profile) => authenticate(&profile, options),
|
Ok(profile) => authenticate(options, &profile),
|
||||||
Err(_) => init(options),
|
Err(_) => init(options),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -121,7 +121,7 @@ pub fn init(options: Options) -> anyhow::Result<()> {
|
||||||
|
|
||||||
/// Try loading the identity's key into SSH Agent, falling back to verifying `RAD_PASSPHRASE` for
|
/// Try loading the identity's key into SSH Agent, falling back to verifying `RAD_PASSPHRASE` for
|
||||||
/// use.
|
/// use.
|
||||||
pub fn authenticate(profile: &Profile, options: Options) -> anyhow::Result<()> {
|
pub fn authenticate(options: Options, profile: &Profile) -> anyhow::Result<()> {
|
||||||
// Authenticate with SSH Agent only if it is running.
|
// Authenticate with SSH Agent only if it is running.
|
||||||
match ssh::agent::Agent::connect() {
|
match ssh::agent::Agent::connect() {
|
||||||
Ok(mut agent) => {
|
Ok(mut agent) => {
|
||||||
|
|
|
||||||
|
|
@ -103,10 +103,10 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
||||||
let mut node = radicle::Node::new(profile.socket());
|
let mut node = radicle::Node::new(profile.socket());
|
||||||
let (working, doc, proj) = clone(
|
let (working, doc, proj) = clone(
|
||||||
options.id,
|
options.id,
|
||||||
|
options.announce,
|
||||||
|
&mut node,
|
||||||
&signer,
|
&signer,
|
||||||
&profile.storage,
|
&profile.storage,
|
||||||
&mut node,
|
|
||||||
options.announce,
|
|
||||||
)?;
|
)?;
|
||||||
let delegates = doc
|
let delegates = doc
|
||||||
.delegates
|
.delegates
|
||||||
|
|
@ -161,10 +161,10 @@ pub enum CloneError {
|
||||||
|
|
||||||
pub fn clone<G: Signer>(
|
pub fn clone<G: Signer>(
|
||||||
id: Id,
|
id: Id,
|
||||||
|
announce: bool,
|
||||||
|
node: &mut Node,
|
||||||
signer: &G,
|
signer: &G,
|
||||||
storage: &Storage,
|
storage: &Storage,
|
||||||
node: &mut Node,
|
|
||||||
announce: bool,
|
|
||||||
) -> Result<(raw::Repository, Doc<Verified>, Project), CloneError> {
|
) -> Result<(raw::Repository, Doc<Verified>, Project), CloneError> {
|
||||||
let me = *signer.public_key();
|
let me = *signer.public_key();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -115,9 +115,9 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
||||||
let storage = &profile.storage;
|
let storage = &profile.storage;
|
||||||
|
|
||||||
match options.op {
|
match options.op {
|
||||||
Operation::Add { id, did } => add::run(&profile, storage, get_id(id)?, *did)?,
|
Operation::Add { id, did } => add::run(get_id(id)?, *did, &profile, storage)?,
|
||||||
Operation::Remove { id, did } => remove::run(&profile, storage, get_id(id)?, &did)?,
|
Operation::Remove { id, did } => remove::run(get_id(id)?, &did, &profile, storage)?,
|
||||||
Operation::List { id } => list::run(&profile, storage, get_id(id)?)?,
|
Operation::List { id } => list::run(get_id(id)?, &profile, storage)?,
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ use radicle_crypto::PublicKey;
|
||||||
|
|
||||||
use crate::terminal as term;
|
use crate::terminal as term;
|
||||||
|
|
||||||
pub fn run<S>(profile: &Profile, storage: &S, id: Id, key: PublicKey) -> anyhow::Result<()>
|
pub fn run<S>(id: Id, key: PublicKey, profile: &Profile, storage: &S) -> anyhow::Result<()>
|
||||||
where
|
where
|
||||||
S: WriteStorage,
|
S: WriteStorage,
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ use radicle::{prelude::Id, storage::ReadStorage, Profile};
|
||||||
|
|
||||||
use crate::terminal as term;
|
use crate::terminal as term;
|
||||||
|
|
||||||
pub fn run<S>(profile: &Profile, storage: &S, id: Id) -> anyhow::Result<()>
|
pub fn run<S>(id: Id, profile: &Profile, storage: &S) -> anyhow::Result<()>
|
||||||
where
|
where
|
||||||
S: ReadStorage,
|
S: ReadStorage,
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ use radicle_crypto::PublicKey;
|
||||||
|
|
||||||
use crate::terminal as term;
|
use crate::terminal as term;
|
||||||
|
|
||||||
pub fn run<S>(profile: &Profile, storage: &S, id: Id, key: &PublicKey) -> anyhow::Result<()>
|
pub fn run<S>(id: Id, key: &PublicKey, profile: &Profile, storage: &S) -> anyhow::Result<()>
|
||||||
where
|
where
|
||||||
S: WriteStorage,
|
S: WriteStorage,
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -297,16 +297,16 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
||||||
ref tags,
|
ref tags,
|
||||||
} => {
|
} => {
|
||||||
open(
|
open(
|
||||||
&mut issues,
|
|
||||||
&signer,
|
|
||||||
&options,
|
|
||||||
title.clone(),
|
title.clone(),
|
||||||
description.clone(),
|
description.clone(),
|
||||||
tags.to_vec(),
|
tags.to_vec(),
|
||||||
|
&options,
|
||||||
|
&mut issues,
|
||||||
|
&signer,
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
Operation::List { assigned } => {
|
Operation::List { assigned } => {
|
||||||
list(&issues, &profile, &assigned)?;
|
list(&issues, &assigned, &profile)?;
|
||||||
}
|
}
|
||||||
Operation::Delete { id } => {
|
Operation::Delete { id } => {
|
||||||
let id = id.resolve(&repo.backend)?;
|
let id = id.resolve(&repo.backend)?;
|
||||||
|
|
@ -329,8 +329,8 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
||||||
|
|
||||||
fn list(
|
fn list(
|
||||||
issues: &Issues,
|
issues: &Issues,
|
||||||
profile: &profile::Profile,
|
|
||||||
assigned: &Option<Assigned>,
|
assigned: &Option<Assigned>,
|
||||||
|
profile: &profile::Profile,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
let me = *profile.id();
|
let me = *profile.id();
|
||||||
|
|
||||||
|
|
@ -484,12 +484,12 @@ fn prompt_issue(
|
||||||
}
|
}
|
||||||
|
|
||||||
fn open<G: Signer>(
|
fn open<G: Signer>(
|
||||||
issues: &mut Issues,
|
|
||||||
signer: &G,
|
|
||||||
options: &Options,
|
|
||||||
title: Option<String>,
|
title: Option<String>,
|
||||||
description: Option<String>,
|
description: Option<String>,
|
||||||
tags: Vec<Tag>,
|
tags: Vec<Tag>,
|
||||||
|
options: &Options,
|
||||||
|
issues: &mut Issues,
|
||||||
|
signer: &G,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
let Some((meta, description)) = prompt_issue(
|
let Some((meta, description)) = prompt_issue(
|
||||||
&title.unwrap_or_default(),
|
&title.unwrap_or_default(),
|
||||||
|
|
|
||||||
|
|
@ -364,21 +364,21 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
||||||
quiet,
|
quiet,
|
||||||
} => {
|
} => {
|
||||||
create::run(
|
create::run(
|
||||||
&repository,
|
|
||||||
&profile,
|
|
||||||
&workdir,
|
|
||||||
message.clone(),
|
message.clone(),
|
||||||
draft,
|
draft,
|
||||||
quiet,
|
quiet,
|
||||||
options,
|
options,
|
||||||
|
&profile,
|
||||||
|
&repository,
|
||||||
|
&workdir,
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
Operation::List { filter: Filter(f) } => {
|
Operation::List { filter: Filter(f) } => {
|
||||||
list::run(&repository, &profile, f)?;
|
list::run(f, &repository, &profile)?;
|
||||||
}
|
}
|
||||||
Operation::Show { patch_id, diff } => {
|
Operation::Show { patch_id, diff } => {
|
||||||
let patch_id = patch_id.resolve(&repository.backend)?;
|
let patch_id = patch_id.resolve(&repository.backend)?;
|
||||||
show::run(&profile, &repository, &workdir, &patch_id, diff)?;
|
show::run(&patch_id, diff, &profile, &repository, &workdir)?;
|
||||||
}
|
}
|
||||||
Operation::Update {
|
Operation::Update {
|
||||||
ref patch_id,
|
ref patch_id,
|
||||||
|
|
@ -390,34 +390,34 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
||||||
.map(|id| id.resolve(&repository.backend))
|
.map(|id| id.resolve(&repository.backend))
|
||||||
.transpose()?;
|
.transpose()?;
|
||||||
update::run(
|
update::run(
|
||||||
&repository,
|
|
||||||
&profile,
|
|
||||||
&workdir,
|
|
||||||
patch_id,
|
patch_id,
|
||||||
message.clone(),
|
message.clone(),
|
||||||
quiet,
|
quiet,
|
||||||
&options,
|
&options,
|
||||||
|
&profile,
|
||||||
|
&repository,
|
||||||
|
&workdir,
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
Operation::Archive { ref patch_id } => {
|
Operation::Archive { ref patch_id } => {
|
||||||
let patch_id = patch_id.resolve::<PatchId>(&repository.backend)?;
|
let patch_id = patch_id.resolve::<PatchId>(&repository.backend)?;
|
||||||
archive::run(&repository, &profile, &patch_id)?;
|
archive::run(&patch_id, &profile, &repository)?;
|
||||||
}
|
}
|
||||||
Operation::Ready { ref patch_id, undo } => {
|
Operation::Ready { ref patch_id, undo } => {
|
||||||
let patch_id = patch_id.resolve::<PatchId>(&repository.backend)?;
|
let patch_id = patch_id.resolve::<PatchId>(&repository.backend)?;
|
||||||
ready::run(&repository, &profile, &patch_id, undo)?;
|
ready::run(&patch_id, undo, &profile, &repository)?;
|
||||||
}
|
}
|
||||||
Operation::Delete { patch_id } => {
|
Operation::Delete { patch_id } => {
|
||||||
let patch_id = patch_id.resolve(&repository.backend)?;
|
let patch_id = patch_id.resolve(&repository.backend)?;
|
||||||
delete::run(&repository, &profile, &patch_id)?;
|
delete::run(&patch_id, &profile, &repository)?;
|
||||||
}
|
}
|
||||||
Operation::Checkout { patch_id } => {
|
Operation::Checkout { patch_id } => {
|
||||||
let patch_id = patch_id.resolve(&repository.backend)?;
|
let patch_id = patch_id.resolve(&repository.backend)?;
|
||||||
checkout::run(&repository, &workdir, &patch_id)?;
|
checkout::run(&patch_id, &repository, &workdir)?;
|
||||||
}
|
}
|
||||||
Operation::Edit { patch_id, message } => {
|
Operation::Edit { patch_id, message } => {
|
||||||
let patch_id = patch_id.resolve(&repository.backend)?;
|
let patch_id = patch_id.resolve(&repository.backend)?;
|
||||||
edit::run(&repository, &profile, &patch_id, message)?;
|
edit::run(&patch_id, message, &profile, &repository)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ use radicle::cob::patch;
|
||||||
use radicle::prelude::*;
|
use radicle::prelude::*;
|
||||||
use radicle::storage::git::Repository;
|
use radicle::storage::git::Repository;
|
||||||
|
|
||||||
pub fn run(repository: &Repository, profile: &Profile, patch_id: &PatchId) -> anyhow::Result<()> {
|
pub fn run(patch_id: &PatchId, profile: &Profile, repository: &Repository) -> anyhow::Result<()> {
|
||||||
let signer = term::signer(profile)?;
|
let signer = term::signer(profile)?;
|
||||||
let mut patches = patch::Patches::open(repository)?;
|
let mut patches = patch::Patches::open(repository)?;
|
||||||
let Ok(mut patch) = patches.get_mut(patch_id) else {
|
let Ok(mut patch) = patches.get_mut(patch_id) else {
|
||||||
|
|
|
||||||
|
|
@ -10,9 +10,9 @@ use radicle::storage::ReadRepository;
|
||||||
use crate::terminal as term;
|
use crate::terminal as term;
|
||||||
|
|
||||||
pub fn run(
|
pub fn run(
|
||||||
|
patch_id: &PatchId,
|
||||||
stored: &Repository,
|
stored: &Repository,
|
||||||
working: &git::raw::Repository,
|
working: &git::raw::Repository,
|
||||||
patch_id: &PatchId,
|
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
let patches = patch::Patches::open(stored)?;
|
let patches = patch::Patches::open(stored)?;
|
||||||
let patch = patches
|
let patch = patches
|
||||||
|
|
|
||||||
|
|
@ -46,13 +46,13 @@ fn show_patch_commit_info(
|
||||||
|
|
||||||
/// Run patch creation.
|
/// Run patch creation.
|
||||||
pub fn run(
|
pub fn run(
|
||||||
storage: &Repository,
|
|
||||||
profile: &Profile,
|
|
||||||
workdir: &git::raw::Repository,
|
|
||||||
message: term::patch::Message,
|
message: term::patch::Message,
|
||||||
draft: bool,
|
draft: bool,
|
||||||
quiet: bool,
|
quiet: bool,
|
||||||
options: Options,
|
options: Options,
|
||||||
|
profile: &Profile,
|
||||||
|
storage: &Repository,
|
||||||
|
workdir: &git::raw::Repository,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
let mut patches = patch::Patches::open(storage)?;
|
let mut patches = patch::Patches::open(storage)?;
|
||||||
let head_branch = try_branch(workdir.head()?)?;
|
let head_branch = try_branch(workdir.head()?)?;
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ use radicle::storage::git::Repository;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
pub fn run(repository: &Repository, profile: &Profile, patch_id: &PatchId) -> anyhow::Result<()> {
|
pub fn run(patch_id: &PatchId, profile: &Profile, repository: &Repository) -> anyhow::Result<()> {
|
||||||
let signer = &term::signer(profile)?;
|
let signer = &term::signer(profile)?;
|
||||||
let patches = patch::Patches::open(repository)?;
|
let patches = patch::Patches::open(repository)?;
|
||||||
patches.remove(patch_id, signer)?;
|
patches.remove(patch_id, signer)?;
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,10 @@ use radicle::storage::git::Repository;
|
||||||
use crate::terminal as term;
|
use crate::terminal as term;
|
||||||
|
|
||||||
pub fn run(
|
pub fn run(
|
||||||
repository: &Repository,
|
|
||||||
profile: &Profile,
|
|
||||||
patch_id: &PatchId,
|
patch_id: &PatchId,
|
||||||
message: term::patch::Message,
|
message: term::patch::Message,
|
||||||
|
profile: &Profile,
|
||||||
|
repository: &Repository,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
let signer = term::signer(profile)?;
|
let signer = term::signer(profile)?;
|
||||||
let mut patches = patch::Patches::open(repository)?;
|
let mut patches = patch::Patches::open(repository)?;
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,9 @@ use super::common;
|
||||||
|
|
||||||
/// List patches.
|
/// List patches.
|
||||||
pub fn run(
|
pub fn run(
|
||||||
|
filter: fn(&patch::State) -> bool,
|
||||||
repository: &Repository,
|
repository: &Repository,
|
||||||
profile: &Profile,
|
profile: &Profile,
|
||||||
filter: fn(&patch::State) -> bool,
|
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
let patches = Patches::open(repository)?;
|
let patches = Patches::open(repository)?;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,10 @@ use radicle::prelude::*;
|
||||||
use radicle::storage::git::Repository;
|
use radicle::storage::git::Repository;
|
||||||
|
|
||||||
pub fn run(
|
pub fn run(
|
||||||
repository: &Repository,
|
|
||||||
profile: &Profile,
|
|
||||||
patch_id: &PatchId,
|
patch_id: &PatchId,
|
||||||
undo: bool,
|
undo: bool,
|
||||||
|
profile: &Profile,
|
||||||
|
repository: &Repository,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
let signer = term::signer(profile)?;
|
let signer = term::signer(profile)?;
|
||||||
let mut patches = patch::Patches::open(repository)?;
|
let mut patches = patch::Patches::open(repository)?;
|
||||||
|
|
|
||||||
|
|
@ -53,12 +53,12 @@ fn patch_commits(patch: &patch::Patch, stored: &Repository) -> anyhow::Result<Ve
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn run(
|
pub fn run(
|
||||||
|
patch_id: &PatchId,
|
||||||
|
diff: bool,
|
||||||
profile: &Profile,
|
profile: &Profile,
|
||||||
stored: &Repository,
|
stored: &Repository,
|
||||||
// TODO: Should be optional.
|
// TODO: Should be optional.
|
||||||
workdir: &git::raw::Repository,
|
workdir: &git::raw::Repository,
|
||||||
patch_id: &PatchId,
|
|
||||||
diff: bool,
|
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
let patches = patch::Patches::open(stored)?;
|
let patches = patch::Patches::open(stored)?;
|
||||||
let Some(patch) = patches.get(patch_id)? else {
|
let Some(patch) = patches.get(patch_id)? else {
|
||||||
|
|
|
||||||
|
|
@ -54,13 +54,13 @@ fn show_update_commit_info(
|
||||||
|
|
||||||
/// Run patch update.
|
/// Run patch update.
|
||||||
pub fn run(
|
pub fn run(
|
||||||
storage: &Repository,
|
|
||||||
profile: &Profile,
|
|
||||||
workdir: &git::raw::Repository,
|
|
||||||
patch_id: Option<patch::PatchId>,
|
patch_id: Option<patch::PatchId>,
|
||||||
message: term::patch::Message,
|
message: term::patch::Message,
|
||||||
quiet: bool,
|
quiet: bool,
|
||||||
options: &Options,
|
options: &Options,
|
||||||
|
profile: &Profile,
|
||||||
|
storage: &Repository,
|
||||||
|
workdir: &git::raw::Repository,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
// `HEAD`; This is what we are proposing as a patch.
|
// `HEAD`; This is what we are proposing as a patch.
|
||||||
let head_branch = try_branch(workdir.head()?)?;
|
let head_branch = try_branch(workdir.head()?)?;
|
||||||
|
|
|
||||||
|
|
@ -114,8 +114,8 @@ pub fn run(options: Options, ctx: impl Context) -> anyhow::Result<()> {
|
||||||
let profile = ctx.profile()?;
|
let profile = ctx.profile()?;
|
||||||
|
|
||||||
match options.op {
|
match options.op {
|
||||||
Operation::Add { ref id, name } => self::add::run(&working, &profile, id, name, rid)?,
|
Operation::Add { ref id, name } => self::add::run(rid, id, name, &profile, &working)?,
|
||||||
Operation::Rm { ref name } => self::rm::run(&working, name)?,
|
Operation::Rm { ref name } => self::rm::run(name, &working)?,
|
||||||
Operation::List => self::list::run(&working)?,
|
Operation::List => self::list::run(&working)?,
|
||||||
};
|
};
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,11 @@ use crate::git::add_remote;
|
||||||
use crate::{git, terminal as term};
|
use crate::{git, terminal as term};
|
||||||
|
|
||||||
pub fn run(
|
pub fn run(
|
||||||
repository: &git::Repository,
|
id: Id,
|
||||||
profile: &Profile,
|
|
||||||
pubkey: &PublicKey,
|
pubkey: &PublicKey,
|
||||||
name: Option<String>,
|
name: Option<String>,
|
||||||
id: Id,
|
profile: &Profile,
|
||||||
|
repository: &git::Repository,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
let name = match name {
|
let name = match name {
|
||||||
Some(name) => name,
|
Some(name) => name,
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use crate::git;
|
use crate::git;
|
||||||
use crate::terminal as term;
|
use crate::terminal as term;
|
||||||
|
|
||||||
pub fn run(repository: &git::Repository, name: &str) -> anyhow::Result<()> {
|
pub fn run(name: &str, repository: &git::Repository) -> anyhow::Result<()> {
|
||||||
if !git::is_remote(repository, name)? {
|
if !git::is_remote(repository, name)? {
|
||||||
anyhow::bail!("remote `{name}` not found");
|
anyhow::bail!("remote `{name}` not found");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -136,18 +136,18 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
||||||
let mut node = radicle::Node::new(profile.socket());
|
let mut node = radicle::Node::new(profile.socket());
|
||||||
|
|
||||||
match options.mode {
|
match options.mode {
|
||||||
SyncMode::Announce => announce(rid, node, options.timeout),
|
SyncMode::Announce => announce(rid, options.timeout, node),
|
||||||
SyncMode::Fetch => fetch(rid, profile, &mut node, options.seed),
|
SyncMode::Fetch => fetch(rid, options.seed, &mut node, profile),
|
||||||
SyncMode::Both => {
|
SyncMode::Both => {
|
||||||
fetch(rid, profile, &mut node, options.seed)?;
|
fetch(rid, options.seed, &mut node, profile)?;
|
||||||
announce(rid, node, options.timeout)?;
|
announce(rid, options.timeout, node)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn announce(rid: Id, mut node: Node, timeout: time::Duration) -> anyhow::Result<()> {
|
fn announce(rid: Id, timeout: time::Duration, mut node: Node) -> anyhow::Result<()> {
|
||||||
let seeds = node.seeds(rid)?;
|
let seeds = node.seeds(rid)?;
|
||||||
if !seeds.has_connections() {
|
if !seeds.has_connections() {
|
||||||
term::info!("Not connected to any seeds.");
|
term::info!("Not connected to any seeds.");
|
||||||
|
|
@ -180,9 +180,9 @@ fn announce(rid: Id, mut node: Node, timeout: time::Duration) -> anyhow::Result<
|
||||||
|
|
||||||
pub fn fetch(
|
pub fn fetch(
|
||||||
rid: Id,
|
rid: Id,
|
||||||
profile: Profile,
|
|
||||||
node: &mut Node,
|
|
||||||
seed: Option<NodeId>,
|
seed: Option<NodeId>,
|
||||||
|
node: &mut Node,
|
||||||
|
profile: Profile,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
if !profile.tracking()?.is_repo_tracked(&rid)? {
|
if !profile.tracking()?.is_repo_tracked(&rid)? {
|
||||||
anyhow::bail!("repository {rid} is not tracked");
|
anyhow::bail!("repository {rid} is not tracked");
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
||||||
track_repo(rid, scope, &mut node)?;
|
track_repo(rid, scope, &mut node)?;
|
||||||
|
|
||||||
if options.fetch {
|
if options.fetch {
|
||||||
sync::fetch(rid, profile, &mut node, None)?;
|
sync::fetch(rid, None, &mut node, profile)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue