From 0b7147a2a53d62e64ed2806245ba099e9f19548d Mon Sep 17 00:00:00 2001 From: horpto <__Singleton__@hackerdom.ru> Date: Thu, 6 Aug 2020 17:35:27 +0300 Subject: [PATCH] fix docs, completion and docker service Signed-off-by: horpto <__Singleton__@hackerdom.ru> --- cli/command/service/logs.go | 2 +- contrib/completion/bash/docker | 12 ++++++------ contrib/completion/fish/docker.fish | 2 +- contrib/completion/zsh/_docker | 4 ++-- docs/reference/commandline/logs.md | 2 +- docs/reference/commandline/service_logs.md | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cli/command/service/logs.go b/cli/command/service/logs.go index deef9dd221..22ced8f7b7 100644 --- a/cli/command/service/logs.go +++ b/cli/command/service/logs.go @@ -63,7 +63,7 @@ func newLogsCommand(dockerCli command.Cli) *cobra.Command { flags.BoolVarP(&opts.timestamps, "timestamps", "t", false, "Show timestamps") flags.BoolVar(&opts.details, "details", false, "Show extra details provided to logs") flags.SetAnnotation("details", "version", []string{"1.30"}) - flags.StringVar(&opts.tail, "tail", "all", "Number of lines to show from the end of the logs") + flags.StringVarP(&opts.tail, "tail", "n", "all", "Number of lines to show from the end of the logs") return cmd } diff --git a/contrib/completion/bash/docker b/contrib/completion/bash/docker index f86263ec78..a102c5fff3 100644 --- a/contrib/completion/bash/docker +++ b/contrib/completion/bash/docker @@ -1672,17 +1672,17 @@ _docker_container_kill() { _docker_container_logs() { case "$prev" in - --since|--tail|--until) + --since|--tail|-n|--until) return ;; esac case "$cur" in -*) - COMPREPLY=( $( compgen -W "--details --follow -f --help --since --tail --timestamps -t --until" -- "$cur" ) ) + COMPREPLY=( $( compgen -W "--details --follow -f --help --since --tail -n --timestamps -t --until" -- "$cur" ) ) ;; *) - local counter=$(__docker_pos_first_nonflag '--since|--tail|--until') + local counter=$(__docker_pos_first_nonflag '--since|--tail|-n|--until') if [ "$cword" -eq "$counter" ]; then __docker_complete_containers_all fi @@ -3526,17 +3526,17 @@ _docker_service_inspect() { _docker_service_logs() { case "$prev" in - --since|--tail) + --since|--tail|-n) return ;; esac case "$cur" in -*) - COMPREPLY=( $( compgen -W "--details --follow -f --help --no-resolve --no-task-ids --no-trunc --raw --since --tail --timestamps -t" -- "$cur" ) ) + COMPREPLY=( $( compgen -W "--details --follow -f --help --no-resolve --no-task-ids --no-trunc --raw --since --tail -n --timestamps -t" -- "$cur" ) ) ;; *) - local counter=$(__docker_pos_first_nonflag '--since|--tail') + local counter=$(__docker_pos_first_nonflag '--since|--tail|-n') if [ "$cword" -eq "$counter" ]; then __docker_complete_services_and_tasks fi diff --git a/contrib/completion/fish/docker.fish b/contrib/completion/fish/docker.fish index b58332779f..41984746a7 100644 --- a/contrib/completion/fish/docker.fish +++ b/contrib/completion/fish/docker.fish @@ -373,7 +373,7 @@ complete -c docker -A -f -n '__fish_seen_subcommand_from logs' -s f -l follow -d complete -c docker -A -f -n '__fish_seen_subcommand_from logs' -l help -d 'Print usage' complete -c docker -A -f -n '__fish_seen_subcommand_from logs' -s t -l timestamps -d 'Show timestamps' complete -c docker -A -f -n '__fish_seen_subcommand_from logs' -l since -d 'Show logs since timestamp' -complete -c docker -A -f -n '__fish_seen_subcommand_from logs' -l tail -d 'Output the specified number of lines at the end of logs (defaults to all logs)' +complete -c docker -A -f -n '__fish_seen_subcommand_from logs' -s n -l tail -d 'Output the specified number of lines at the end of logs (defaults to all logs)' complete -c docker -A -f -n '__fish_seen_subcommand_from logs' -a '(__fish_print_docker_containers running)' -d "Container" # network diff --git a/contrib/completion/zsh/_docker b/contrib/completion/zsh/_docker index c3caa32b1a..bcbef5e0d9 100644 --- a/contrib/completion/zsh/_docker +++ b/contrib/completion/zsh/_docker @@ -792,7 +792,7 @@ __docker_container_subcommand() { "($help -f --follow)"{-f,--follow}"[Follow log output]" \ "($help -s --since)"{-s=,--since=}"[Show logs since this timestamp]:timestamp: " \ "($help -t --timestamps)"{-t,--timestamps}"[Show timestamps]" \ - "($help)--tail=[Output the last K lines]:lines:(1 10 20 50 all)" \ + "($help -n --tail)"{-n=,--tail=}"[Number of lines to show from the end of the logs]:lines:(1 10 20 50 all)" \ "($help -)*:containers:__docker_complete_containers" && ret=0 ;; (ls|list) @@ -2038,7 +2038,7 @@ __docker_service_subcommand() { "($help)--no-task-ids[Do not include task IDs]" \ "($help)--no-trunc[Do not truncate output]" \ "($help)--since=[Show logs since timestamp]:timestamp: " \ - "($help)--tail=[Number of lines to show from the end of the logs]:lines:(1 10 20 50 all)" \ + "($help -n --tail)"{-n=,--tail=}"[Number of lines to show from the end of the logs]:lines:(1 10 20 50 all)" \ "($help -t --timestamps)"{-t,--timestamps}"[Show timestamps]" \ "($help -)1:service:__docker_complete_services" && ret=0 ;; diff --git a/docs/reference/commandline/logs.md b/docs/reference/commandline/logs.md index 36e21f1361..68cabbcbab 100644 --- a/docs/reference/commandline/logs.md +++ b/docs/reference/commandline/logs.md @@ -17,7 +17,7 @@ Options: --help Print usage --since string Show logs since timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes) --until string Show logs before timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes) - --tail string Number of lines to show from the end of the logs (default "all") + -n, --tail string Number of lines to show from the end of the logs (default "all") -t, --timestamps Show timestamps ``` diff --git a/docs/reference/commandline/service_logs.md b/docs/reference/commandline/service_logs.md index fe5dcae28c..590981e92f 100644 --- a/docs/reference/commandline/service_logs.md +++ b/docs/reference/commandline/service_logs.md @@ -18,7 +18,7 @@ Options: --no-task-ids Do not include task IDs in output --no-trunc Do not truncate output --since string Show logs since timestamp - --tail string Number of lines to show from the end of the logs (default "all") + -n, --tail string Number of lines to show from the end of the logs (default "all") -t, --timestamps Show timestamps ```