diff options
Diffstat (limited to 'cli/src/profile.rs')
-rw-r--r-- | cli/src/profile.rs | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/cli/src/profile.rs b/cli/src/profile.rs index 87b1e54..c239bc5 100644 --- a/cli/src/profile.rs +++ b/cli/src/profile.rs @@ -36,10 +36,14 @@ async fn profile_serve(matches: &ArgMatches) -> Result<()> { use ipfs::MultiaddrWithPeerId; let name = matches.value_of("name").map(String::from).unwrap(); // required - let connect_peer = matches.value_of("connect").map(|s| { - s.parse::<MultiaddrWithPeerId>() - .map_err(anyhow::Error::from) - }).transpose()?; + let connect_peer = matches.values_of("connect") + .map(|v| { + v.map(|s| { + s.parse::<MultiaddrWithPeerId>().map_err(anyhow::Error::from) + }) + .collect::<Result<Vec<_>>>() + }) + .transpose()?; let state_dir = Profile::state_dir_path(&name)?; @@ -51,8 +55,10 @@ async fn profile_serve(matches: &ArgMatches) -> Result<()> { } if let Some(connect_to) = connect_peer { - log::info!("Connecting to {:?}", connect_to); - profile.connect(connect_to).await?; + for c in connect_to { + log::info!("Connecting to {:?}", c); + profile.connect(c).await?; + } } let running = Arc::new(AtomicBool::new(true)); |