There is a command: docker ps --format "{{.ID}}\t{{.Command}}" --no-trunc
(used https://pkg.go.dev/text/template)
which outputs the full text of the '{{.Command}}'
(which I need), but outputs too long '{{.ID}}'
I need to take the first 12 characters from '{{.ID}}'
and all characters (--no-trunc
) from '{{.Command}}'
. How to do it?
CodePudding user response:
You can use the ´printf` function in the Go template like this
docker ps --format "{{printf \"%.12s\" .ID}}\t{{.Command}}" --no-trunc