16 Commits
Author SHA1 Message Date
Sebastiaan van Stijn 5f9299935a client/pkg/jsonmessage: add custom message printer
Add WithMessagePrinter to allow callers of DisplayStream and
DisplayMessages to customize presentation of non-auxiliary messages.

The custom printer replaces the default terminal-aware rendering, allowing
callers to handle progress output, terminal sizing, and message errors as
needed. Auxiliary messages continue to use WithAuxCallback.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-08-27 23:40:23 +02:00
Sebastiaan van Stijn aab60119ef client/pkg/jsonmessage: Display: fix godoc link
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-07-14 13:15:53 +02:00
Sebastiaan van Stijn 9aa5ac3034 client/pkg/jsonmessage: use functional options for display funcs
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-04-01 17:27:18 +02:00
Sebastiaan van Stijn 6aedc6ba32 client/pkg/jsonmessage: add DisplayStream and DisplayMessages utils
These can replace the existing DisplayJSONMessagesStream and DisplayJSONMessages
functions, not requiring the caller to perform terminal detection.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-03-31 15:31:07 +02:00
Sebastiaan van Stijn 571080854b client: go fix
Result of running `go fix -mod=readonly ./...` (twice).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-03-14 19:30:07 +01:00
Sebastiaan van Stijn 8b4edd73b3 client/pkg/jsonmessage: make DisplayJSONMessages accept a iter.Seq2
The `DisplayJSONMessages` only accepted a `JSONMessagesStream`. This meant that
it would not accept the output from (for example) [client.ImagePushResponse].

This patch:

- Makes `DisplayJSONMessages` accept any `iter.Seq2[jsonstream.Message, error]`
- Makes `JSONMessagesStream` an alias instead of a concrete type (TBD if we
  actually need the type).
- Some minor cleanups in the implementation.

[client.ImagePushResponse]: https://github.com/moby/moby/blob/fa87120ae64a170fd42096de3b873b439b95016b/client/image_push.go#L20-L24

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-02-20 13:40:56 +01:00
Sebastiaan van Stijn c5a0bfd9ff client/pkg/jsonmessage: fix typo in godoc
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-02-19 09:54:19 +01:00
Cory Snider bbaeb9036f client/pkg/jsonmessage: use api message def'ns
Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-10-28 17:10:34 -04:00
Sebastiaan van Stijn c7fe7136d2 client: gofumpt
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-22 14:01:01 +02:00
Nicolas De Loof e6bac8983b introduce ImagePullResponse to manage JSONMessage stream decoding
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-10-09 15:36:22 +02:00
Sebastiaan van Stijn 47bdbf5a4b client/pkg/jsonmessage: remove unused fields
The JSONMessage struct contained fields that were previously used to produce the
`/events` response. However, commit 72f1881df1
introduced an events.Message type that replaced the use of JSONMessage for
that purpose, and clients no longer use the JSONMessage struct to unmarshal
those responses.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-19 17:55:01 +02:00
Sebastiaan van Stijn 195a6bbb1e client: touch-up godoc
Not perfect yet, but addressing some godoc "doc" links that needed
to be updated, and touching up some references.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-02 17:12:05 +02:00
Sebastiaan van Stijn f3ba0b2dc2 client/pkg/jsonmessage: remove Stream interface
It was an interface to match CLI-specific primitives and is no
longer used.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-30 23:22:12 +02:00
Sebastiaan van Stijn 19edf5c53c client/pkg/jsonmessage: remove DisplayJSONMessagesToStream
It was an adaptor around DisplayJSONMessagesStream for CLI-specific
primitives that was used in the CLI, but can be implemented by users
of this package.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-30 23:22:09 +02:00
Sebastiaan van Stijn fdaccdb233 pkg/jsonmessage: stop printing deprecated progressDetail, errorDetail
The API still returns it for backward-compatibility (but probably
shouldn't), but we should no longer print it. This removes the
use of these fields for printing, but keeps them for streamformatter
to use.

- ErrorMessage was deprecated in 3043c26419
- ProgressMessage was deprecated in 597e0e69b4

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-30 22:51:13 +02:00
Derek McGowan 0d8ca8eefe Move pkg/jsonmessage to client/pkg/jsonmessage
Signed-off-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-30 14:22:31 +02:00