Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli): warn when removing the last/host target for a toolchain #3637

Merged
merged 2 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions src/cli/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,12 +448,7 @@ pub(crate) fn list_components(

pub(crate) fn list_installed_components(distributable: DistributableToolchain<'_>) -> Result<()> {
let t = process().stdout();
let manifestation = distributable.get_manifestation()?;
let config = manifestation.read_config()?.unwrap_or_default();
let manifest = distributable.get_manifest()?;
let components = manifest.query_components(distributable.desc(), &config)?;

for component in components {
for component in distributable.components()? {
if component.installed {
writeln!(t.lock(), "{}", component.name)?;
}
Expand Down
7 changes: 7 additions & 0 deletions src/toolchain/distributable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ impl<'a> DistributableToolchain<'a> {
Ok(())
}

pub(crate) fn components(&self) -> anyhow::Result<Vec<crate::dist::manifest::ComponentStatus>> {
rami3l marked this conversation as resolved.
Show resolved Hide resolved
let manifestation = self.get_manifestation()?;
let config = manifestation.read_config()?.unwrap_or_default();
let manifest = self.get_manifest()?;
manifest.query_components(self.desc(), &config)
}

/// Are all the components installed in this distribution
pub(crate) fn components_exist(
&self,
Expand Down