Signed-off-by: Josh Horwitz <horwitzja@gmail.com>
| ... | ... |
@@ -15,6 +15,7 @@ import ( |
| 15 | 15 |
type psOptions struct {
|
| 16 | 16 |
nodeID string |
| 17 | 17 |
noResolve bool |
| 18 |
+ noTrunc bool |
|
| 18 | 19 |
filter opts.FilterOpt |
| 19 | 20 |
} |
| 20 | 21 |
|
| ... | ... |
@@ -31,6 +32,7 @@ func newPSCommand(dockerCli *client.DockerCli) *cobra.Command {
|
| 31 | 31 |
}, |
| 32 | 32 |
} |
| 33 | 33 |
flags := cmd.Flags() |
| 34 |
+ flags.BoolVar(&opts.noTrunc, "no-trunc", false, "Do not truncate output") |
|
| 34 | 35 |
flags.BoolVar(&opts.noResolve, "no-resolve", false, "Do not map IDs to Names") |
| 35 | 36 |
flags.VarP(&opts.filter, "filter", "f", "Filter output based on conditions provided") |
| 36 | 37 |
|
| ... | ... |
@@ -59,5 +61,5 @@ func runPS(dockerCli *client.DockerCli, opts psOptions) error {
|
| 59 | 59 |
return err |
| 60 | 60 |
} |
| 61 | 61 |
|
| 62 |
- return task.Print(dockerCli, ctx, tasks, idresolver.New(client, opts.noResolve)) |
|
| 62 |
+ return task.Print(dockerCli, ctx, tasks, idresolver.New(client, opts.noResolve), opts.noTrunc) |
|
| 63 | 63 |
} |
| ... | ... |
@@ -16,6 +16,7 @@ import ( |
| 16 | 16 |
type psOptions struct {
|
| 17 | 17 |
serviceID string |
| 18 | 18 |
noResolve bool |
| 19 |
+ noTrunc bool |
|
| 19 | 20 |
filter opts.FilterOpt |
| 20 | 21 |
} |
| 21 | 22 |
|
| ... | ... |
@@ -32,6 +33,7 @@ func newPSCommand(dockerCli *client.DockerCli) *cobra.Command {
|
| 32 | 32 |
}, |
| 33 | 33 |
} |
| 34 | 34 |
flags := cmd.Flags() |
| 35 |
+ flags.BoolVar(&opts.noTrunc, "no-trunc", false, "Do not truncate output") |
|
| 35 | 36 |
flags.BoolVar(&opts.noResolve, "no-resolve", false, "Do not map IDs to Names") |
| 36 | 37 |
flags.VarP(&opts.filter, "filter", "f", "Filter output based on conditions provided") |
| 37 | 38 |
|
| ... | ... |
@@ -66,5 +68,5 @@ func runPS(dockerCli *client.DockerCli, opts psOptions) error {
|
| 66 | 66 |
return err |
| 67 | 67 |
} |
| 68 | 68 |
|
| 69 |
- return task.Print(dockerCli, ctx, tasks, idresolver.New(client, opts.noResolve)) |
|
| 69 |
+ return task.Print(dockerCli, ctx, tasks, idresolver.New(client, opts.noResolve), opts.noTrunc) |
|
| 70 | 70 |
} |
| ... | ... |
@@ -20,6 +20,7 @@ import ( |
| 20 | 20 |
type psOptions struct {
|
| 21 | 21 |
all bool |
| 22 | 22 |
filter opts.FilterOpt |
| 23 |
+ noTrunc bool |
|
| 23 | 24 |
namespace string |
| 24 | 25 |
noResolve bool |
| 25 | 26 |
} |
| ... | ... |
@@ -38,6 +39,7 @@ func newPSCommand(dockerCli *client.DockerCli) *cobra.Command {
|
| 38 | 38 |
} |
| 39 | 39 |
flags := cmd.Flags() |
| 40 | 40 |
flags.BoolVarP(&opts.all, "all", "a", false, "Display all tasks") |
| 41 |
+ flags.BoolVar(&opts.noTrunc, "no-trunc", false, "Do not truncate output") |
|
| 41 | 42 |
flags.BoolVar(&opts.noResolve, "no-resolve", false, "Do not map IDs to Names") |
| 42 | 43 |
flags.VarP(&opts.filter, "filter", "f", "Filter output based on conditions provided") |
| 43 | 44 |
|
| ... | ... |
@@ -66,5 +68,5 @@ func runPS(dockerCli *client.DockerCli, opts psOptions) error {
|
| 66 | 66 |
return nil |
| 67 | 67 |
} |
| 68 | 68 |
|
| 69 |
- return task.Print(dockerCli, ctx, tasks, idresolver.New(client, opts.noResolve)) |
|
| 69 |
+ return task.Print(dockerCli, ctx, tasks, idresolver.New(client, opts.noResolve), opts.noTrunc) |
|
| 70 | 70 |
} |
| ... | ... |
@@ -41,7 +41,7 @@ func (t tasksBySlot) Less(i, j int) bool {
|
| 41 | 41 |
} |
| 42 | 42 |
|
| 43 | 43 |
// Print task information in a table format |
| 44 |
-func Print(dockerCli *client.DockerCli, ctx context.Context, tasks []swarm.Task, resolver *idresolver.IDResolver) error {
|
|
| 44 |
+func Print(dockerCli *client.DockerCli, ctx context.Context, tasks []swarm.Task, resolver *idresolver.IDResolver, noTrunc bool) error {
|
|
| 45 | 45 |
sort.Stable(tasksBySlot(tasks)) |
| 46 | 46 |
|
| 47 | 47 |
writer := tabwriter.NewWriter(dockerCli.Out(), 0, 4, 2, ' ', 0) |
| ... | ... |
@@ -75,7 +75,7 @@ func Print(dockerCli *client.DockerCli, ctx context.Context, tasks []swarm.Task, |
| 75 | 75 |
|
| 76 | 76 |
// Trim and quote the error message. |
| 77 | 77 |
taskErr := task.Status.Err |
| 78 |
- if len(taskErr) > maxErrLength {
|
|
| 78 |
+ if !noTrunc && len(taskErr) > maxErrLength {
|
|
| 79 | 79 |
taskErr = fmt.Sprintf("%s…", taskErr[:maxErrLength-1])
|
| 80 | 80 |
} |
| 81 | 81 |
if len(taskErr) > 0 {
|
| ... | ... |
@@ -1704,7 +1704,7 @@ _docker_service_ps() {
|
| 1704 | 1704 |
|
| 1705 | 1705 |
case "$cur" in |
| 1706 | 1706 |
-*) |
| 1707 |
- COMPREPLY=( $( compgen -W "--all -a --filter -f --help --no-resolve" -- "$cur" ) ) |
|
| 1707 |
+ COMPREPLY=( $( compgen -W "--all -a --filter -f --help --no-resolve --no-trunc" -- "$cur" ) ) |
|
| 1708 | 1708 |
;; |
| 1709 | 1709 |
*) |
| 1710 | 1710 |
local counter=$(__docker_pos_first_nonflag '--filter|-f') |
| ... | ... |
@@ -2076,7 +2076,7 @@ _docker_node_ps() {
|
| 2076 | 2076 |
|
| 2077 | 2077 |
case "$cur" in |
| 2078 | 2078 |
-*) |
| 2079 |
- COMPREPLY=( $( compgen -W "--all -a --filter -f --help --no-resolve" -- "$cur" ) ) |
|
| 2079 |
+ COMPREPLY=( $( compgen -W "--all -a --filter -f --help --no-resolve --no-trunc" -- "$cur" ) ) |
|
| 2080 | 2080 |
;; |
| 2081 | 2081 |
*) |
| 2082 | 2082 |
local counter=$(__docker_pos_first_nonflag '--filter|-f') |
| ... | ... |
@@ -841,6 +841,7 @@ __docker_node_subcommand() {
|
| 841 | 841 |
"($help -a --all)"{-a,--all}"[Display all instances]" \
|
| 842 | 842 |
"($help)*"{-f=,--filter=}"[Provide filter values]:filter:->filter-options" \
|
| 843 | 843 |
"($help)--no-resolve[Do not map IDs to Names]" \ |
| 844 |
+ "($help)--no-trunc[Do not truncate output]" \ |
|
| 844 | 845 |
"($help -)1:node:__docker_complete_nodes" && ret=0 |
| 845 | 846 |
case $state in |
| 846 | 847 |
(filter-options) |
| ... | ... |
@@ -1156,6 +1157,7 @@ __docker_service_subcommand() {
|
| 1156 | 1156 |
"($help -a --all)"{-a,--all}"[Display all tasks]" \
|
| 1157 | 1157 |
"($help)*"{-f=,--filter=}"[Provide filter values]:filter:->filter-options" \
|
| 1158 | 1158 |
"($help)--no-resolve[Do not map IDs to Names]" \ |
| 1159 |
+ "($help)--no-trunc[Do not truncate output]" \ |
|
| 1159 | 1160 |
"($help -)1:service:__docker_complete_services" && ret=0 |
| 1160 | 1161 |
case $state in |
| 1161 | 1162 |
(filter-options) |
| ... | ... |
@@ -21,6 +21,7 @@ Options: |
| 21 | 21 |
-f, --filter value Filter output based on conditions provided |
| 22 | 22 |
--help Print usage |
| 23 | 23 |
--no-resolve Do not map IDs to Names |
| 24 |
+ --no-trunc Do not truncate output |
|
| 24 | 25 |
``` |
| 25 | 26 |
|
| 26 | 27 |
Lists all the tasks on a Node that Docker knows about. You can filter using the `-f` or `--filter` flag. Refer to the [filtering](#filtering) section for more information about available filter options. |
| ... | ... |
@@ -21,6 +21,7 @@ Options: |
| 21 | 21 |
-f, --filter value Filter output based on conditions provided |
| 22 | 22 |
--help Print usage |
| 23 | 23 |
--no-resolve Do not map IDs to Names |
| 24 |
+ --no-trunc Do not truncate output |
|
| 24 | 25 |
``` |
| 25 | 26 |
|
| 26 | 27 |
Lists the tasks that are running as part of the specified service. This command |