7
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-06-28 09:23:30 +00:00
tutor/tutor/fmt.py
2019-05-29 09:53:54 +02:00

47 lines
803 B
Python

import click
def title(text):
indent = 8
separator = "=" * (len(text) + 2 * indent)
message = "{separator}\n{indent}{text}\n{separator}".format(
separator=separator, indent=" " * indent, text=text
)
return click.style(message, fg="green")
def echo_info(text):
echo(info(text))
def info(text):
return click.style(text, fg="blue")
def error(text):
return click.style(text, fg="red")
def echo_error(text):
echo(error(text), err=True)
def command(text):
return click.style(text, fg="magenta")
def question(text):
return click.style(text, fg="yellow")
def echo_alert(text):
echo(alert(text))
def alert(text):
return click.style("⚠️ " + text, fg="yellow", bold=True)
def echo(text, err=False):
click.echo(text, err=err)