Skip to content

Commit

Permalink
truncate command by default, introduce --no-trunc flag to get the ful…
Browse files Browse the repository at this point in the history
…l command

Signed-off-by: Nicolas De Loof <[email protected]>
  • Loading branch information
ndeloof committed Sep 23, 2023
1 parent cd743d1 commit 44d2128
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/compose/ps.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type psOptions struct {
Services bool
Filter string
Status []string
noTrunc bool
}

func (p *psOptions) parseFilter() error {
Expand Down Expand Up @@ -84,6 +85,7 @@ func psCommand(p *ProjectOptions, dockerCli command.Cli, backend api.Service) *c
flags.BoolVarP(&opts.Quiet, "quiet", "q", false, "Only display IDs")
flags.BoolVar(&opts.Services, "services", false, "Display services")
flags.BoolVarP(&opts.All, "all", "a", false, "Show all stopped containers (including those created by the run command)")
flags.BoolVar(&opts.noTrunc, "no-trunc", false, "Don't truncate output")
return psCmd
}

Expand Down Expand Up @@ -145,6 +147,7 @@ func runPs(ctx context.Context, dockerCli command.Cli, backend api.Service, serv
containerCtx := cliformatter.Context{
Output: dockerCli.Out(),
Format: formatter.NewContainerFormat(opts.Format, opts.Quiet, false),
Trunc: !opts.noTrunc,
}
return formatter.ContainerWrite(containerCtx, containers)
}
Expand Down
1 change: 1 addition & 0 deletions docs/reference/compose_ps.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ List containers
| `--dry-run` | | | Execute command in dry run mode |
| [`--filter`](#filter) | `string` | | Filter services by a property (supported filters: status). |
| [`--format`](#format) | `string` | `table` | Format output using a custom template:<br>'table': Print output in table format with column headers (default)<br>'table TEMPLATE': Print output in table format using the given Go template<br>'json': Print in JSON format<br>'TEMPLATE': Print output using the given Go template.<br>Refer to https://docs.docker.com/go/formatting/ for more information about formatting output with templates |
| `--no-trunc` | | | Don't truncate output |
| `-q`, `--quiet` | | | Only display IDs |
| `--services` | | | Display services |
| [`--status`](#status) | `stringArray` | | Filter services by status. Values: [paused \| restarting \| removing \| running \| dead \| created \| exited] |
Expand Down
10 changes: 10 additions & 0 deletions docs/reference/docker_compose_ps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@ options:
experimentalcli: false
kubernetes: false
swarm: false
- option: no-trunc
value_type: bool
default_value: "false"
description: Don't truncate output
deprecated: false
hidden: false
experimental: false
experimentalcli: false
kubernetes: false
swarm: false
- option: quiet
shorthand: q
value_type: bool
Expand Down

0 comments on commit 44d2128

Please sign in to comment.