Skip to content
Snippets Groups Projects
Commit 47cb77c1 authored by Urs Baumann's avatar Urs Baumann :bath:
Browse files

Merge branch 'more-output' into 'master'

More output

See merge request !1
parents d12985f0 c0f08ab4
Branches
No related tags found
1 merge request!1More output
from logging import error
import time
import sys
from click.termui import style
import typer
......@@ -23,6 +24,11 @@ def upload_file(
),
url: str = typer.Argument("http://localhost:5000/testbook", envvar="TAAS_URL"),
):
modified = round(time.time() - notebook.stat().st_mtime)
sec = 'second' if modified == 1 else 'seconds'
suffix = ', [red]make sure you saved![/]' if modified >= 10 else ''
console.print(f"Last change: [bold]{modified}[/bold] {sec} ago{suffix}")
files = {"file": open(notebook, "rb")}
try:
with console.status("[bold green]Testing..."):
......@@ -60,9 +66,12 @@ def upload_file(
try:
print(f"[red]Error: {exc.response.json().get('error')}[/]", file=sys.stderr)
print(f"[red]Message: {exc.response.json().get('msg')}[/]", file=sys.stderr)
print(":boom: [bold]Submission failed![/]")
except:
pass
typer.Exit(code=1)
raise typer.Exit(code=1)
print(":mailbox: :heavy_check_mark: [bold]Submission successful![/]")
def run():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment