journal: limit to printing 100 lines by default

This commit is contained in:
Christophe Siraut 2020-08-25 11:19:33 +02:00
parent de333ea848
commit 565d4f903b
1 changed files with 2 additions and 1 deletions

View File

@ -15,10 +15,11 @@ class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument("--full", action="store_true")
parser.add_argument("-n", "--lines", default=100)
def handle(self, *args, **options):
_, columns = os.popen("stty size", "r").read().split()
for entry in Entry.objects.all():
for entry in reversed(Entry.objects.order_by('-timestamp')[:int(options['lines'])]):
line = "%s %s %s" % (
entry.timestamp.strftime("%c"),
entry.host,