Skip to content

Commit 8231e9a

Browse files
committed
refactor(toolchain): extract DistributableToolchain::components()
1 parent 469d6a8 commit 8231e9a

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/cli/common.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -448,12 +448,7 @@ pub(crate) fn list_components(
448448

449449
pub(crate) fn list_installed_components(distributable: DistributableToolchain<'_>) -> Result<()> {
450450
let t = process().stdout();
451-
let manifestation = distributable.get_manifestation()?;
452-
let config = manifestation.read_config()?.unwrap_or_default();
453-
let manifest = distributable.get_manifest()?;
454-
let components = manifest.query_components(distributable.desc(), &config)?;
455-
456-
for component in components {
451+
for component in distributable.components()? {
457452
if component.installed {
458453
writeln!(t.lock(), "{}", component.name)?;
459454
}

src/toolchain/distributable.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,13 @@ impl<'a> DistributableToolchain<'a> {
115115
Ok(())
116116
}
117117

118+
pub(crate) fn components(&self) -> anyhow::Result<Vec<crate::dist::manifest::ComponentStatus>> {
119+
let manifestation = self.get_manifestation()?;
120+
let config = manifestation.read_config()?.unwrap_or_default();
121+
let manifest = self.get_manifest()?;
122+
manifest.query_components(self.desc(), &config)
123+
}
124+
118125
/// Are all the components installed in this distribution
119126
pub(crate) fn components_exist(
120127
&self,

0 commit comments

Comments
 (0)