fix: docker ps parse if id/name is too long

This commit is contained in:
lollipopkit
2024-06-08 20:57:56 +08:00
parent 8121eef839
commit 9f34021c90
8 changed files with 69 additions and 34 deletions

View File

@@ -276,9 +276,13 @@ enum ContainerCmdType {
return switch (this) {
ContainerCmdType.version => '$prefix version $_jsonFmt',
ContainerCmdType.ps => switch (type) {
/// TODO: Rollback to json format when permformance recovers.
/// Use [_jsonFmt] in Docker will cause the operation to slow down.
ContainerType.docker => '$prefix ps -a --format "table {{printf \\"'
'%-15.15s ${"%-30.30s " * 3}\\" .ID .Names .Image .Status}}"',
'%-15.15s '
'%-30.30s '
'${"%-50.50s " * 2}\\"'
' .ID .Status .Names .Image}}"',
ContainerType.podman => '$prefix ps -a $_jsonFmt',
},
ContainerCmdType.stats =>