Use the user's configured URL for mentions by default

This commit is contained in:
Lucidiot 2019-09-02 23:21:06 +02:00
parent f61ae4fae8
commit 70e932f2d7
Signed by: lucidiot
GPG Key ID: 3358C1CA6906FB8D
1 changed files with 11 additions and 3 deletions

View File

@ -62,11 +62,19 @@ def tweets(ctx, query):
@cli.command()
@click.argument('url', required=True)
@click.argument('url', required=False)
@click.pass_context
def mentions(ctx, url):
# TODO: Allow names instead of URLs for known users
# TODO: Use twtxt's config to default to the user's name
if not url:
try:
config = Config.discover()
except ValueError as e:
raise click.UsageError(
'URL was omitted from the command-line, but it could not '
'be deduced from the twtxt config: {!s}'.format(e),
ctx=ctx,
)
url = config.twturl
click.echo(ctx.obj.list_mentions(url).text)