diff options
Diffstat (limited to 'src/commands/what_depends.rs')
-rw-r--r-- | src/commands/what_depends.rs | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/src/commands/what_depends.rs b/src/commands/what_depends.rs index 5ac7def..578e067 100644 --- a/src/commands/what_depends.rs +++ b/src/commands/what_depends.rs @@ -20,26 +20,43 @@ use crate::package::PackageName; use crate::repository::Repository; /// Implementation of the "what_depends" subcommand -pub async fn what_depends(matches: &ArgMatches, config: &Configuration, repo: Repository) -> Result<()> { +pub async fn what_depends( + matches: &ArgMatches, + config: &Configuration, + repo: Repository, +) -> Result<()> { use filters::failable::filter::FailableFilter; - let print_runtime_deps = getbool(matches, "dependency_type", crate::cli::IDENT_DEPENDENCY_TYPE_RUNTIME); - let print_build_deps = getbool(matches, "dependency_type", crate::cli::IDENT_DEPENDENCY_TYPE_BUILD); + let print_runtime_deps = getbool( + matches, + "dependency_type", + crate::cli::IDENT_DEPENDENCY_TYPE_RUNTIME, + ); + let print_build_deps = getbool( + matches, + "dependency_type", + crate::cli::IDENT_DEPENDENCY_TYPE_BUILD, + ); let package_filter = { - let name = matches.value_of("package_name").map(String::from).map(PackageName::from).unwrap(); + let name = matches + .value_of("package_name") + .map(String::from) + .map(PackageName::from) + .unwrap(); crate::util::filters::build_package_filter_by_dependency_name( &name, print_build_deps, - print_runtime_deps + print_runtime_deps, ) }; let format = config.package_print_format(); let mut stdout = std::io::stdout(); - let packages = repo.packages() + let packages = repo + .packages() .map(|package| package_filter.filter(package).map(|b| (b, package))) .filter_ok(|(b, _)| *b) .map_ok(|tpl| tpl.1) @@ -65,4 +82,3 @@ pub async fn what_depends(matches: &ArgMatches, config: &Configuration, repo: Re crate::ui::print_packages(&mut stdout, format, packages.into_iter(), config, &flags) } - |