m/cup
1
0
mirror of https://github.com/sergi0g/cup.git synced 2025-11-21 03:13:43 -05:00

feat: allow usage without a daemon (#142)

This commit is contained in:
makonde-on-git
2025-10-14 17:05:11 +02:00
committed by GitHub
parent 547d418401
commit 6ab06db5cb
4 changed files with 20 additions and 2 deletions

View File

@@ -41,6 +41,9 @@ pub async fn get_images_from_docker_daemon(
ctx: &Context,
references: &Option<Vec<String>>,
) -> Vec<Image> {
if ctx.config.socket.as_deref() == Some("none") {
return vec![];
}
let client: Docker = create_docker_client(ctx.config.socket.as_deref());
let mut swarm_images = match client.list_services::<String>(None).await {
Ok(services) => services
@@ -96,6 +99,10 @@ pub async fn get_images_from_docker_daemon(
}
pub async fn get_in_use_images(ctx: &Context) -> Vec<String> {
if ctx.config.socket.as_deref() == Some("none") {
return vec![];
}
let client: Docker = create_docker_client(ctx.config.socket.as_deref());
let containers = match client