Exemplo n.º 1
0
def tweet(ctx, created_at, twtfile, text):
    """Append a new tweet to your twtxt file."""
    tweet = Tweet(text, created_at) if created_at else Tweet(text)
    if not add_local_tweet(tweet, twtfile):
        click.echo("✗ Couldn’t write to file.")
    else:
        hook = ctx.obj["conf"].post_tweet_hook
        if hook:
            run_post_tweet_hook(hook, ctx.obj["conf"].options)
Exemplo n.º 2
0
Arquivo: cli.py Projeto: djmaze/twtxt
def tweet(ctx, created_at, twtfile, text):
    """Append a new tweet to your twtxt file."""
    tweet = Tweet(text, created_at) if created_at else Tweet(text)
    if not add_local_tweet(tweet, twtfile):
        click.echo("✗ Couldn’t write to file.")
    else:
        hook = ctx.obj["conf"].post_tweet_hook
        if hook:
            run_post_tweet_hook(hook, ctx.obj["conf"].options)
Exemplo n.º 3
0
Arquivo: cli.py Projeto: chkry/twtxt
def tweet(ctx, created_at, twtfile, text):
    """Append a new tweet to your twtxt file."""
    text = expand_mentions(text)
    tweet = Tweet(text, created_at) if created_at else Tweet(text)

    pre_tweet_hook = ctx.obj["conf"].pre_tweet_hook
    if pre_tweet_hook:
        if not run_pre_tweet_hook(pre_tweet_hook, ctx.obj["conf"].options):
            click.echo("✗ pre_tweet_hook returned non-zero")
            raise click.Abort

    if not add_local_tweet(tweet, twtfile):
        click.echo("✗ Couldn’t write to file.")
    else:
        post_tweet_hook = ctx.obj["conf"].post_tweet_hook
        if post_tweet_hook:
            run_post_tweet_hook(post_tweet_hook, ctx.obj["conf"].options)
Exemplo n.º 4
0
def tweet(ctx, created_at, twtfile, text):
    """Append a new tweet to your twtxt file."""
    text = expand_mentions(text)
    tweet = Tweet(text, created_at) if created_at else Tweet(text)

    pre_tweet_hook = ctx.obj["conf"].pre_tweet_hook
    if pre_tweet_hook:
        if not run_pre_tweet_hook(pre_tweet_hook, ctx.obj["conf"].options):
            click.echo("✗ pre_tweet_hook returned non-zero")
            raise click.Abort

    if not add_local_tweet(tweet, twtfile):
        click.echo("✗ Couldn’t write to file.")
    else:
        post_tweet_hook = ctx.obj["conf"].post_tweet_hook
        if post_tweet_hook:
            run_post_tweet_hook(post_tweet_hook, ctx.obj["conf"].options)