mirror of https://github.com/docker/cli.git
Merge pull request #2646 from horpto/patch-1
Add shorthand for --tail option
This commit is contained in:
commit
ca35f2973a
|
@ -43,7 +43,7 @@ func NewLogsCommand(dockerCli command.Cli) *cobra.Command {
|
|||
flags.SetAnnotation("until", "version", []string{"1.35"})
|
||||
flags.BoolVarP(&opts.timestamps, "timestamps", "t", false, "Show timestamps")
|
||||
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
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
@ -3527,17 +3527,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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -793,7 +793,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)
|
||||
|
@ -2040,7 +2040,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
|
||||
;;
|
||||
|
|
|
@ -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
|
||||
```
|
||||
|
||||
|
|
|
@ -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
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in New Issue