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
|
//! ref: composer/src/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php
use crate::dependency_resolver::operation::operation_interface::OperationInterface;
use crate::dependency_resolver::operation::solver_operation::SolverOperation;
use crate::package::alias_package::AliasPackage;
use crate::package::package_interface::PackageInterface;
#[derive(Debug)]
pub struct MarkAliasInstalledOperation {
pub(crate) package: AliasPackage,
}
impl MarkAliasInstalledOperation {
pub fn new(package: AliasPackage) -> Self {
Self { package }
}
pub fn get_package(&self) -> &AliasPackage {
&self.package
}
}
impl SolverOperation for MarkAliasInstalledOperation {
const TYPE: &'static str = "markAliasInstalled";
}
impl OperationInterface for MarkAliasInstalledOperation {
fn get_operation_type(&self) -> String {
Self::TYPE.to_string()
}
fn show(&self, _lock: bool) -> String {
format!(
"Marking <info>{}</info> (<comment>{}</comment>) as installed, alias of <info>{}</info> (<comment>{}</comment>)",
PackageInterface::get_pretty_name(&self.package),
PackageInterface::get_full_pretty_version(
&self.package,
true,
<dyn PackageInterface>::DISPLAY_SOURCE_REF_IF_DEV,
),
PackageInterface::get_pretty_name(self.package.get_alias_of()),
PackageInterface::get_full_pretty_version(
self.package.get_alias_of(),
true,
<dyn PackageInterface>::DISPLAY_SOURCE_REF_IF_DEV,
),
)
}
fn to_string(&self) -> String {
self.show(true)
}
}
|