diff --git a/toot/config.py b/toot/config.py index 98ee6d8..4548ea5 100644 --- a/toot/config.py +++ b/toot/config.py @@ -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 {}".format(path)) - # Ensure dir exists os.makedirs(dirname(path), exist_ok=True) diff --git a/toot/utils/__init__.py b/toot/utils/__init__.py index c4afa7f..268918a 100644 --- a/toot/utils/__init__.py +++ b/toot/utils/__init__.py @@ -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"Found a draft status at: {tmp_path}") - print_out("[O]pen (default) or [D]elete? ", 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