Skip to content

Commit 2bf19ac

Browse files
committed
Just add addr globally
caller needs to figure out the addr before invoking run
1 parent 0e438dd commit 2bf19ac

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/cli.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ impl std::str::FromStr for TicketOrHash {
181181

182182
impl BlobCommands {
183183
/// Runs the blob command given the iroh client.
184-
pub async fn run(self, blobs: &blobs::Client) -> Result<()> {
184+
pub async fn run(self, blobs: &blobs::Client, addr: NodeAddr) -> Result<()> {
185185
match self {
186186
Self::Get {
187187
ticket,
@@ -352,7 +352,7 @@ impl BlobCommands {
352352
Self::Add {
353353
source: path,
354354
options,
355-
} => add_with_opts(blobs, path, options).await,
355+
} => add_with_opts(blobs, addr, path, options).await,
356356
Self::Share {
357357
hash,
358358
addr_options,
@@ -365,7 +365,7 @@ impl BlobCommands {
365365
BlobFormat::Raw
366366
};
367367
let status = blobs.status(hash).await?;
368-
let mut addr: NodeAddr = todo!();
368+
let mut addr = addr;
369369
addr.apply_options(addr_options);
370370
let ticket = BlobTicket::new(addr, hash, format)?;
371371

@@ -815,6 +815,7 @@ pub enum TicketOption {
815815
/// Adds a [`BlobSource`] given some [`BlobAddOptions`].
816816
pub async fn add_with_opts(
817817
blobs: &blobs::Client,
818+
addr: NodeAddr,
818819
source: BlobSource,
819820
opts: BlobAddOptions,
820821
) -> Result<()> {
@@ -842,12 +843,13 @@ pub async fn add_with_opts(
842843
(false, Some(_)) => bail!("`--filename` may not be used without `--wrap`"),
843844
};
844845

845-
add(blobs, source, tag, ticket, wrap).await
846+
add(blobs, addr, source, tag, ticket, wrap).await
846847
}
847848

848849
/// Adds data to iroh, either from a path or, if path is `None`, from STDIN.
849850
pub async fn add(
850851
blobs: &blobs::Client,
852+
addr: NodeAddr,
851853
source: BlobSourceIroh,
852854
tag: SetTagOption,
853855
ticket: TicketOption,
@@ -881,7 +883,6 @@ pub async fn add(
881883

882884
print_add_response(hash, format, entries);
883885
if let TicketOption::Print = ticket {
884-
let addr = todo!();
885886
let ticket = BlobTicket::new(addr, hash, format)?;
886887
println!("All-in-one ticket: {ticket}");
887888
}

0 commit comments

Comments
 (0)