mirror of
https://github.com/ihabunek/toot
synced 2025-02-12 18:10:45 +01:00
Use click.echo to output text
This commit is contained in:
parent
452b98d2ad
commit
eaaa14cfc2
@ -7,7 +7,6 @@ from typing import Optional
|
||||
|
||||
from toot import User, App, get_config_dir
|
||||
from toot.exceptions import ConsoleError
|
||||
from toot.output import print_out
|
||||
|
||||
|
||||
TOOT_CONFIG_FILE_NAME = "config.json"
|
||||
@ -30,8 +29,6 @@ def make_config(path):
|
||||
"active_user": None,
|
||||
}
|
||||
|
||||
print_out("Creating config file at <blue>{}</blue>".format(path))
|
||||
|
||||
# Ensure dir exists
|
||||
os.makedirs(dirname(path), exist_ok=True)
|
||||
|
||||
|
@ -9,6 +9,8 @@ import warnings
|
||||
from bs4 import BeautifulSoup
|
||||
from typing import Dict
|
||||
|
||||
import click
|
||||
|
||||
from toot.exceptions import ConsoleError
|
||||
from urllib.parse import urlparse, urlencode, quote, unquote
|
||||
|
||||
@ -148,14 +150,13 @@ def _tmp_status_path() -> str:
|
||||
return f"{tmp_dir}/.status.toot"
|
||||
|
||||
|
||||
def _use_existing_tmp_file(tmp_path) -> bool:
|
||||
from toot.output import print_out
|
||||
|
||||
def _use_existing_tmp_file(tmp_path: str) -> bool:
|
||||
if os.path.exists(tmp_path):
|
||||
print_out(f"<cyan>Found a draft status at: {tmp_path}</cyan>")
|
||||
print_out("<cyan>[O]pen (default) or [D]elete?</cyan> ", end="")
|
||||
char = read_char(["o", "d"], "o")
|
||||
return char == "o"
|
||||
click.echo(f"Found draft status at: {tmp_path}")
|
||||
|
||||
choice = click.Choice(["O", "D"], case_sensitive=False)
|
||||
char = click.prompt("Open or Delete?", type=choice, default="O")
|
||||
return char == "O"
|
||||
|
||||
return False
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user