Skip to content

Commit 26f06cb

Browse files
committed
Show full docker image with verbose mode
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
1 parent 13968de commit 26f06cb

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

commands/list.go

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,21 @@ func runList(cmd *cobra.Command, args []string) error {
7979
fmt.Printf("%s\n", function.Name)
8080
}
8181
} else if verboseList {
82-
fmt.Printf("%-30s\t%-40s\t%-15s\t%-5s\n", "Function", "Image", "Invocations", "Replicas")
82+
83+
maxWidth := 40
8384
for _, function := range functions {
84-
functionImage := function.Image
85-
if len(function.Image) > 40 {
86-
functionImage = functionImage[0:38] + ".."
85+
if len(function.Image) > maxWidth {
86+
maxWidth = len(function.Image)
8787
}
88-
fmt.Printf("%-30s\t%-40s\t%-15d\t%-5d\n", function.Name, functionImage, int64(function.InvocationCount), function.Replicas)
88+
}
89+
90+
fmt.Printf("%-30s\t%-"+fmt.Sprintf("%d", maxWidth)+"s\t%-15s\t%-5s\n", "Function", "Image", "Invocations", "Replicas")
91+
for _, function := range functions {
92+
functionImage := function.Image
93+
// if len(function.Image) > 40 {
94+
// functionImage = functionImage[0:38] + ".."
95+
// }
96+
fmt.Printf("%-30s\t%-"+fmt.Sprintf("%d", maxWidth)+"s\t%-15d\t%-5d\n", function.Name, functionImage, int64(function.InvocationCount), function.Replicas)
8997
}
9098
} else {
9199
fmt.Printf("%-30s\t%-15s\t%-5s\n", "Function", "Invocations", "Replicas")

0 commit comments

Comments
 (0)