Merge pull request #2646 from horpto/patch-1

Add shorthand for --tail option
This commit is contained in:
Sebastiaan van Stijn 2020-08-17 17:19:03 +02:00 committed by GitHub
commit ca35f2973a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 13 additions and 13 deletions

View File

@ -43,7 +43,7 @@ func NewLogsCommand(dockerCli command.Cli) *cobra.Command {
flags.SetAnnotation("until", "version", []string{"1.35"}) flags.SetAnnotation("until", "version", []string{"1.35"})
flags.BoolVarP(&opts.timestamps, "timestamps", "t", false, "Show timestamps") flags.BoolVarP(&opts.timestamps, "timestamps", "t", false, "Show timestamps")
flags.BoolVar(&opts.details, "details", false, "Show extra details provided to logs") flags.BoolVar(&opts.details, "details", false, "Show extra details provided to logs")
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 return cmd
} }

View File

@ -63,7 +63,7 @@ func newLogsCommand(dockerCli command.Cli) *cobra.Command {
flags.BoolVarP(&opts.timestamps, "timestamps", "t", false, "Show timestamps") flags.BoolVarP(&opts.timestamps, "timestamps", "t", false, "Show timestamps")
flags.BoolVar(&opts.details, "details", false, "Show extra details provided to logs") flags.BoolVar(&opts.details, "details", false, "Show extra details provided to logs")
flags.SetAnnotation("details", "version", []string{"1.30"}) 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 return cmd
} }

View File

@ -1672,17 +1672,17 @@ _docker_container_kill() {
_docker_container_logs() { _docker_container_logs() {
case "$prev" in case "$prev" in
--since|--tail|--until) --since|--tail|-n|--until)
return return
;; ;;
esac esac
case "$cur" in 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 if [ "$cword" -eq "$counter" ]; then
__docker_complete_containers_all __docker_complete_containers_all
fi fi
@ -3527,17 +3527,17 @@ _docker_service_inspect() {
_docker_service_logs() { _docker_service_logs() {
case "$prev" in case "$prev" in
--since|--tail) --since|--tail|-n)
return return
;; ;;
esac esac
case "$cur" in 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 if [ "$cword" -eq "$counter" ]; then
__docker_complete_services_and_tasks __docker_complete_services_and_tasks
fi fi

View File

@ -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' -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' -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 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" complete -c docker -A -f -n '__fish_seen_subcommand_from logs' -a '(__fish_print_docker_containers running)' -d "Container"
# network # network

View File

@ -793,7 +793,7 @@ __docker_container_subcommand() {
"($help -f --follow)"{-f,--follow}"[Follow log output]" \ "($help -f --follow)"{-f,--follow}"[Follow log output]" \
"($help -s --since)"{-s=,--since=}"[Show logs since this timestamp]:timestamp: " \ "($help -s --since)"{-s=,--since=}"[Show logs since this timestamp]:timestamp: " \
"($help -t --timestamps)"{-t,--timestamps}"[Show timestamps]" \ "($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 "($help -)*:containers:__docker_complete_containers" && ret=0
;; ;;
(ls|list) (ls|list)
@ -2040,7 +2040,7 @@ __docker_service_subcommand() {
"($help)--no-task-ids[Do not include task IDs]" \ "($help)--no-task-ids[Do not include task IDs]" \
"($help)--no-trunc[Do not truncate output]" \ "($help)--no-trunc[Do not truncate output]" \
"($help)--since=[Show logs since timestamp]:timestamp: " \ "($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 -t --timestamps)"{-t,--timestamps}"[Show timestamps]" \
"($help -)1:service:__docker_complete_services" && ret=0 "($help -)1:service:__docker_complete_services" && ret=0
;; ;;

View File

@ -17,7 +17,7 @@ Options:
--help Print usage --help Print usage
--since string Show logs since timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes) --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) --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 -t, --timestamps Show timestamps
``` ```

View File

@ -18,7 +18,7 @@ Options:
--no-task-ids Do not include task IDs in output --no-task-ids Do not include task IDs in output
--no-trunc Do not truncate output --no-trunc Do not truncate output
--since string Show logs since timestamp --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 -t, --timestamps Show timestamps
``` ```