cli icon indicating copy to clipboard operation
cli copied to clipboard

Parameters are available in an inconsistent way (e.g. human, no-trunc)

Open Scal-Human opened this issue 1 year ago • 2 comments

Description

Trying to automate information manipulation using docker cli is complicate as parameters such as human=false or no-trunc are not available consistently. To give some examples:

  1. image history
  2. image inspect
  3. image ls
  4. system df
  • human=false is available on 1 but not 2, 3 and 4, forcing to parse a formatted value
  • no-trunc is required to have complete ID's in 1 and 3 while not needed in 2 and 4 In addition UniqueSize reported by 4 is often 0 as shown in the excerpt below (the first value after "image" is supposed to be the UniqueSize). Images-Excerpt

Scal-Human avatar Jul 25 '24 20:07 Scal-Human

Hiya @Scal-Human, thanks for the report.

We definitely have a lot of UX inconsistencies in the CLI that we'd like to address! (And indeed, we have been doing some work to sort through all the commands and do a review to highlight everything).

We do have to do this with some consideration, since changing some of these would mean breaking lots of scripts relying on some of them, so unfortunately some past decisions we simply must live with.

For these specific examples however, if you're trying to parse all this information programatically, I'd suggest using --format=json available for all of them which will output easily-parseable JSON with the requested information. In general I think we prefer this --format option to allow users to select the form they want their output with, so rather than fiddling with --human=false. This can be combined with --no-trunc to prevent truncating IDs.

laurazard avatar Aug 20 '24 11:08 laurazard

@laurazard Thank you, but that is my point, it is not easily parseable as some of them contains human-formatted values (sizes ...) we cannot get rid of.

Scal-Human avatar Aug 24 '24 10:08 Scal-Human