fix: Fix handling multiple input bundles
This commit is contained in:
parent
c514f36bcb
commit
6bb5aef407
2 changed files with 18 additions and 2 deletions
|
@ -11,6 +11,8 @@ use futures::future::try_join_all;
|
||||||
use glob::Pattern;
|
use glob::Pattern;
|
||||||
use tokio::{fs, sync::RwLock};
|
use tokio::{fs, sync::RwLock};
|
||||||
|
|
||||||
|
use crate::cmd::util::collect_bundle_paths;
|
||||||
|
|
||||||
fn parse_glob_pattern(s: &str) -> Result<Pattern, String> {
|
fn parse_glob_pattern(s: &str) -> Result<Pattern, String> {
|
||||||
match Pattern::new(s) {
|
match Pattern::new(s) {
|
||||||
Ok(p) => Ok(p),
|
Ok(p) => Ok(p),
|
||||||
|
@ -148,7 +150,13 @@ pub(crate) async fn run(ctx: Arc<RwLock<dtmt::Context>>, matches: &ArgMatches) -
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
.cloned();
|
.cloned();
|
||||||
|
|
||||||
let bundles = try_join_all(bundles.into_iter().map(|p| async {
|
let paths = collect_bundle_paths(bundles).await;
|
||||||
|
|
||||||
|
if paths.is_empty() {
|
||||||
|
return Err(eyre::eyre!("No bundle provided"));
|
||||||
|
}
|
||||||
|
|
||||||
|
let bundles = try_join_all(paths.into_iter().map(|p| async {
|
||||||
let ctx = ctx.clone();
|
let ctx = ctx.clone();
|
||||||
let path_display = p.display().to_string();
|
let path_display = p.display().to_string();
|
||||||
async move { Bundle::open(ctx, &p).await }
|
async move { Bundle::open(ctx, &p).await }
|
||||||
|
|
|
@ -8,6 +8,8 @@ use dtmt::Bundle;
|
||||||
use futures::future::try_join_all;
|
use futures::future::try_join_all;
|
||||||
use tokio::sync::RwLock;
|
use tokio::sync::RwLock;
|
||||||
|
|
||||||
|
use crate::cmd::util::collect_bundle_paths;
|
||||||
|
|
||||||
pub(crate) fn command_definition() -> Command {
|
pub(crate) fn command_definition() -> Command {
|
||||||
Command::new("list")
|
Command::new("list")
|
||||||
.about("List the contents of one or multiple bundles.")
|
.about("List the contents of one or multiple bundles.")
|
||||||
|
@ -36,7 +38,13 @@ pub(crate) async fn run(ctx: Arc<RwLock<dtmt::Context>>, matches: &ArgMatches) -
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
.cloned();
|
.cloned();
|
||||||
|
|
||||||
let bundles = try_join_all(bundles.into_iter().map(|p| async {
|
let paths = collect_bundle_paths(bundles).await;
|
||||||
|
|
||||||
|
if paths.is_empty() {
|
||||||
|
return Err(eyre::eyre!("No bundle provided"));
|
||||||
|
}
|
||||||
|
|
||||||
|
let bundles = try_join_all(paths.into_iter().map(|p| async {
|
||||||
let ctx = ctx.clone();
|
let ctx = ctx.clone();
|
||||||
let path_display = p.display().to_string();
|
let path_display = p.display().to_string();
|
||||||
async move { Bundle::open(ctx, &p).await }
|
async move { Bundle::open(ctx, &p).await }
|
||||||
|
|
Loading…
Add table
Reference in a new issue