Skip to content

Commit

Permalink
Merge pull request #18 from timofurrer/feature/pipe-tweet
Browse files Browse the repository at this point in the history
Support tweet from stdin
  • Loading branch information
buckket committed Feb 7, 2016
2 parents df38676 + 120f069 commit 0aedf5c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions twtxt/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
:license: MIT, see LICENSE for more details.
"""

import sys
import shlex
import subprocess

Expand Down Expand Up @@ -53,6 +54,10 @@ def validate_created_at(ctx, param, value):
def validate_text(ctx, param, value):
if isinstance(value, tuple):
value = " ".join(value)

if not value and not sys.stdin.isatty():
value = click.get_text_stream("stdin").read()

if value:
if len(value) > 140:
click.confirm("✂ Warning: Tweet is longer than 140 characters. Are you sure?", abort=True)
Expand Down

0 comments on commit 0aedf5c

Please sign in to comment.