1
0
Fork 0
mirror of https://codeberg.org/icewind/haze.git synced 2026-10-01 16:54:08 +02:00

Merge pull request 'feat(pin): Store pinned state in a file within the container' (#32) from artonge/haze:artonge/feat/pinned_state_file into main

Reviewed-on: https://codeberg.org/icewind/haze/pulls/32
This commit is contained in:
Robin Appelman 2026-08-10 23:20:56 +02:00
commit effd3e6949
2 changed files with 39 additions and 43 deletions

View file

@ -68,9 +68,15 @@ async fn main() -> Result<ExitCode> {
match args {
HazeArgs::Clean => {
let list = Cloud::list(&docker, None, &config).await?;
let (retain, remove) = list
.into_iter()
.partition::<Vec<_>, _>(|cloud| cloud.pinned);
let mut retain = Vec::new();
let mut remove = Vec::new();
for cloud in list {
if cloud.is_pinned(&docker).await.unwrap_or(false) {
retain.push(cloud);
} else {
remove.push(cloud);
}
}
for cloud in remove {
if let Err(e) = cloud.destroy(&docker).await {
@ -98,7 +104,11 @@ async fn main() -> Result<ExitCode> {
let mut services: Vec<_> = cloud.services().map(Service::name).collect();
services.push(cloud.db().name());
let services = services.join(", ");
let pin = if cloud.pinned { "*" } else { "" };
let pin = if cloud.is_pinned(&docker).await.unwrap_or(false) {
"*"
} else {
""
};
let version = match cloud.options.version.as_ref() {
Some(version) => format!(", v{version}"),
None => String::new(),