1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
//
// Copyright (c) 2020-2021 science+computing ag and other contributors
//
// This program and the accompanying materials are made
// available under the terms of the Eclipse Public License 2.0
// which is available at https://www.eclipse.org/legal/epl-2.0/
//
// SPDX-License-Identifier: EPL-2.0
//
//! Implementation of the 'dependencies-of' subcommand
use anyhow::Result;
use clap::ArgMatches;
use log::trace;
use crate::commands::util::getbool;
use crate::config::*;
use crate::package::PackageName;
use crate::repository::Repository;
/// Implementation of the "dependencies_of" subcommand
pub async fn dependencies_of(
matches: &ArgMatches,
config: &Configuration,
repo: Repository,
) -> Result<()> {
use filters::filter::Filter;
let package_filter = {
let name = matches
.value_of("package_name")
.map(String::from)
.map(PackageName::from)
.unwrap();
trace!("Checking for package with name = {}", name);
crate::util::filters::build_package_filter_by_name(name)
};
let format = config.package_print_format();
let mut stdout = std::io::stdout();
let iter = repo
.packages()
.filter(|package| package_filter.filter(package))
.inspect(|pkg| trace!("Found package: {:?}", pkg));
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,
);
trace!(
"Printing packages with format = '{}', runtime: {}, build: {}",
format,
print_runtime_deps,
print_build_deps
);
let flags = crate::ui::PackagePrintFlags {
print_all: false,
print_runtime_deps,
print_build_deps,
print_sources: false,
print_dependencies: true,
print_patches: false,
print_env: false,
print_flags: false,
print_allowed_images: false,
print_denied_images: false,
print_phases: false,
print_script: false,
script_line_numbers: false,
script_highlighting: false,
};
crate::ui::print_packages(&mut stdout, format, iter, config, &flags)
}
|