Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(iroh-cli)!: Use gossip cli from iroh-gossip crate #2945

Merged
merged 14 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from 12 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
20 changes: 17 additions & 3 deletions Cargo.lock

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

5 changes: 3 additions & 2 deletions iroh-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ hex = "0.4.3"
human-time = "0.1.6"
indicatif = { version = "0.17", features = ["tokio"] }
iroh = { version = "0.28.1", path = "../iroh", features = ["metrics"] }
iroh-gossip = "0.28.1"
iroh-docs = { version = "0.28.0", features = ["rpc"]}
iroh-blobs = { version = "0.28.1", features = ["cli"] }
iroh-gossip = { version = "0.28.1", features = ["cli"] }
iroh-docs = { version = "0.28.0", features = ["cli"] }
iroh-metrics = { version = "0.28.0" }
parking_lot = "0.12.1"
pkarr = { version = "2.2.0", default-features = false }
Expand Down
32 changes: 16 additions & 16 deletions iroh-cli/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,20 @@ use std::{
use anyhow::{ensure, Context, Result};
use clap::Parser;
use iroh::client::Iroh;
use iroh_blobs::cli::{BlobAddOptions, BlobSource};
use iroh_docs::cli::ConsoleEnv;

use self::{
blobs::{BlobAddOptions, BlobSource},
rpc::RpcCommands,
start::RunType,
};
use crate::config::{ConsoleEnv, NodeConfig};
use self::{rpc::RpcCommands, start::RunType};
use crate::config::NodeConfig;

pub(crate) mod authors;
pub(crate) mod blobs;
pub(crate) mod console;
pub(crate) mod docs;
pub(crate) mod doctor;
pub(crate) mod gossip;
pub(crate) mod net;
pub(crate) mod rpc;
pub(crate) mod start;
pub(crate) mod tags;
pub(crate) use iroh_blobs::{cli as blobs, cli::tags};
pub(crate) use iroh_docs::{cli as docs, cli::authors};
pub(crate) use iroh_gossip::cli as gossip;

/// iroh is a tool for building distributed apps.
///
Expand Down Expand Up @@ -125,7 +121,8 @@ impl Cli {
self.rpc_addr,
RunType::SingleCommandNoAbort,
|iroh| async move {
let env = ConsoleEnv::for_console(data_dir_owned, &iroh).await?;
let env =
ConsoleEnv::for_console(data_dir_owned, &iroh.authors()).await?;
console::run(&iroh, &env).await
},
)
Expand All @@ -137,7 +134,7 @@ impl Cli {
} else {
Iroh::connect_path(data_dir).await.context("rpc connect")?
};
let env = ConsoleEnv::for_console(data_dir_owned, &iroh).await?;
let env = ConsoleEnv::for_console(data_dir_owned, &iroh.authors()).await?;
console::run(&iroh, &env).await
}
}
Expand All @@ -151,7 +148,7 @@ impl Cli {
self.rpc_addr,
RunType::SingleCommandAbortable,
move |iroh| async move {
let env = ConsoleEnv::for_cli(data_dir_owned, &iroh).await?;
let env = ConsoleEnv::for_cli(data_dir_owned, &iroh.authors()).await?;
command.run(&iroh, &env).await
},
)
Expand All @@ -163,7 +160,7 @@ impl Cli {
} else {
Iroh::connect_path(data_dir).await.context("rpc connect")?
};
let env = ConsoleEnv::for_cli(data_dir_owned, &iroh).await?;
let env = ConsoleEnv::for_cli(data_dir_owned, &iroh.authors()).await?;
command.run(&iroh, &env).await
}
}
Expand Down Expand Up @@ -191,7 +188,10 @@ impl Cli {
|client| async move {
match add_command {
None => Ok(()),
Some(command) => command.run(&client).await,
Some(command) => {
let node_addr = client.net().node_addr().await?;
command.run(&client.blobs(), node_addr).await
}
}
},
)
Expand Down
106 changes: 0 additions & 106 deletions iroh-cli/src/commands/authors.rs

This file was deleted.

Loading
Loading