Skip to content

Commit 44d2128

Browse files
committed
truncate command by default, introduce --no-trunc flag to get the full command
Signed-off-by: Nicolas De Loof <[email protected]>
1 parent cd743d1 commit 44d2128

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

cmd/compose/ps.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ type psOptions struct {
4141
Services bool
4242
Filter string
4343
Status []string
44+
noTrunc bool
4445
}
4546

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

@@ -145,6 +147,7 @@ func runPs(ctx context.Context, dockerCli command.Cli, backend api.Service, serv
145147
containerCtx := cliformatter.Context{
146148
Output: dockerCli.Out(),
147149
Format: formatter.NewContainerFormat(opts.Format, opts.Quiet, false),
150+
Trunc: !opts.noTrunc,
148151
}
149152
return formatter.ContainerWrite(containerCtx, containers)
150153
}

docs/reference/compose_ps.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ List containers
1111
| `--dry-run` | | | Execute command in dry run mode |
1212
| [`--filter`](#filter) | `string` | | Filter services by a property (supported filters: status). |
1313
| [`--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 |
14+
| `--no-trunc` | | | Don't truncate output |
1415
| `-q`, `--quiet` | | | Only display IDs |
1516
| `--services` | | | Display services |
1617
| [`--status`](#status) | `stringArray` | | Filter services by status. Values: [paused \| restarting \| removing \| running \| dead \| created \| exited] |

docs/reference/docker_compose_ps.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,16 @@ options:
6060
experimentalcli: false
6161
kubernetes: false
6262
swarm: false
63+
- option: no-trunc
64+
value_type: bool
65+
default_value: "false"
66+
description: Don't truncate output
67+
deprecated: false
68+
hidden: false
69+
experimental: false
70+
experimentalcli: false
71+
kubernetes: false
72+
swarm: false
6373
- option: quiet
6474
shorthand: q
6575
value_type: bool

0 commit comments

Comments
 (0)