Add --tail flag as option on logs.
Closes #265 Signed-off-by: Stéphane Seguin <stephseguin93@gmail.com>
This commit is contained in:
parent
d9b4286f91
commit
9b36dc5c54
6 changed files with 33 additions and 9 deletions
|
|
@ -329,16 +329,24 @@ class TopLevelCommand(DocoptCommand):
|
|||
|
||||
Options:
|
||||
--no-color Produce monochrome output.
|
||||
-f, --follow Follow log output
|
||||
-t, --timestamps Show timestamps
|
||||
-f, --follow Follow log output.
|
||||
-t, --timestamps Show timestamps.
|
||||
--tail="all" Number of lines to show from the end of the logs
|
||||
for each container.
|
||||
"""
|
||||
containers = project.containers(service_names=options['SERVICE'], stopped=True)
|
||||
|
||||
monochrome = options['--no-color']
|
||||
follow = options['--follow']
|
||||
timestamps = options['--timestamps']
|
||||
tail = options['--tail']
|
||||
if tail is not None:
|
||||
if tail.isdigit():
|
||||
tail = int(tail)
|
||||
elif tail != 'all':
|
||||
raise UserError("tail flag must be all or a number")
|
||||
print("Attaching to", list_containers(containers))
|
||||
LogPrinter(containers, monochrome=monochrome, follow=follow, timestamps=timestamps).run()
|
||||
LogPrinter(containers, monochrome=monochrome, follow=follow, timestamps=timestamps, tail=tail).run()
|
||||
|
||||
def pause(self, project, options):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue