From f10d08e79387d2bec553e0b08159e6f769f0f8a6 Mon Sep 17 00:00:00 2001 From: Harald Albers Date: Thu, 14 Jan 2016 12:47:48 -0800 Subject: [PATCH 1/2] bash completion for `--detach-keys` Signed-off-by: Harald Albers Upstream-commit: b24ded193f7175e7f63e2bb8432b430a6665bfdf Component: engine --- .../engine/contrib/completion/bash/docker | 52 +++++++++++++++---- 1 file changed, 42 insertions(+), 10 deletions(-) diff --git a/components/engine/contrib/completion/bash/docker b/components/engine/contrib/completion/bash/docker index 53c58a9cf7..4b12ce6894 100644 --- a/components/engine/contrib/completion/bash/docker +++ b/components/engine/contrib/completion/bash/docker @@ -340,6 +340,25 @@ __docker_complete_capabilities() { " -- "$cur" ) ) } +__docker_complete_detach-keys() { + case "$prev" in + --detach-keys) + case "$cur" in + *,) + COMPREPLY=( $( compgen -W "${cur}ctrl-" -- "$cur" ) ) + ;; + *) + COMPREPLY=( $( compgen -W "ctrl-" -- "$cur" ) ) + ;; + esac + + __docker_nospace + return + ;; + esac + return 1 +} + __docker_complete_isolation() { COMPREPLY=( $( compgen -W "default hyperv process" -- "$cur" ) ) } @@ -513,12 +532,14 @@ _docker_docker() { } _docker_attach() { - case "$cur" in + __docker_complete_detach-keys && return + + case "$cur" in -*) - COMPREPLY=( $( compgen -W "--help --no-stdin --sig-proxy" -- "$cur" ) ) + COMPREPLY=( $( compgen -W "--detach-keys --help --no-stdin --sig-proxy" -- "$cur" ) ) ;; *) - local counter="$(__docker_pos_first_nonflag)" + local counter=$(__docker_pos_first_nonflag '--detach-keys') if [ $cword -eq $counter ]; then __docker_complete_containers_running fi @@ -901,6 +922,8 @@ _docker_events() { } _docker_exec() { + __docker_complete_detach-keys && return + case "$prev" in --user|-u) return @@ -909,7 +932,7 @@ _docker_exec() { case "$cur" in -*) - COMPREPLY=( $( compgen -W "--detach -d --help --interactive -i --privileged -t --tty -u --user" -- "$cur" ) ) + COMPREPLY=( $( compgen -W "--detach -d --detach-keys --help --interactive -i --privileged -t --tty -u --user" -- "$cur" ) ) ;; *) __docker_complete_containers_running @@ -1508,13 +1531,20 @@ _docker_run() { --tty -t " + if [ "$command" = "run" ] ; then + options_with_args="$options_with_args + --detach-keys + " + boolean_options="$boolean_options + --detach -d + --rm + --sig-proxy=false + " + __docker_complete_detach-keys && return + fi + local all_options="$options_with_args $boolean_options" - [ "$command" = "run" ] && all_options="$all_options - --detach -d - --rm - --sig-proxy=false - " case "$prev" in --add-host) @@ -1701,9 +1731,11 @@ _docker_search() { } _docker_start() { + __docker_complete_detach-keys && return + case "$cur" in -*) - COMPREPLY=( $( compgen -W "--attach -a --help --interactive -i" -- "$cur" ) ) + COMPREPLY=( $( compgen -W "--attach -a --detach-keys --help --interactive -i" -- "$cur" ) ) ;; *) __docker_complete_containers_stopped From 198f38f3010ac7f6681ea31bad94c3c90a55f07a Mon Sep 17 00:00:00 2001 From: Harald Albers Date: Thu, 14 Jan 2016 13:58:41 -0800 Subject: [PATCH 2/2] Document that detach keys are a list of key bindings Signed-off-by: Harald Albers Upstream-commit: 3bf821054e1d7681ae76ec3dbba8ea81f4dc5adf Component: engine --- components/engine/docs/reference/commandline/cli.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/engine/docs/reference/commandline/cli.md b/components/engine/docs/reference/commandline/cli.md index e3773f7d63..26d2469a28 100644 --- a/components/engine/docs/reference/commandline/cli.md +++ b/components/engine/docs/reference/commandline/cli.md @@ -107,8 +107,8 @@ directives, see the Once attached to a container, users detach from it and leave it running using the using `CTRL-p CTRL-q` key sequence. This detach key sequence is customizable using the `detachKeys` property. Specify a `` value for the -property. The format of the `` is either a letter [a-Z], or the `ctrl-` -combined with any of the following: +property. The format of the `` is a comma-separated list of either +a letter [a-Z], or the `ctrl-` combined with any of the following: * `a-z` (a single lowercase alpha character ) * `@` (ampersand)