#!/usr/bin/env python3


from blessings import Terminal
import click
import time

term = Terminal()

STATUS_LINES = 2

def move_up():
    click.echo(term.move_up, nl=False)

def clear():
    click.echo(term.clear_eol, nl=False)


def update(message):

    # Move up and clear the status lines
    for i in range(STATUS_LINES):
        move_up()
        clear()

    # Print the message (however long it is, however many lines, shouldnt matter)
    click.echo(message)

    # Add newlines to clear the status area
    for i in range(STATUS_LINES):
        click.echo('')

    # Position ourself for status printing
    for i in range(STATUS_LINES):
        move_up()

    # Print status information
    for i in range(STATUS_LINES):
        click.echo('Status {}'.format(i))


while True:
    time.sleep(1)
    
    update("This is a message !")