Allow piping in text to be tooted - toot - Unnamed repository; edit this file '… | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 2a3d66bae50a7fff4d50319c192dacd5db12365e | |
parent 042eff339deb895fc6d6a1e1e888644f23086308 | |
Author: Ivan Habunek <[email protected]> | |
Date: Wed, 19 Apr 2017 11:03:44 +0200 | |
Allow piping in text to be tooted | |
Diffstat: | |
toot/console.py | 4 ++++ | |
1 file changed, 4 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/toot/console.py b/toot/console.py | |
@@ -481,6 +481,10 @@ def main(): | |
if os.getenv('TOOT_DEBUG'): | |
logging.basicConfig(level=logging.DEBUG) | |
+ # If something is piped in, append it to commandline arguments | |
+ if not sys.stdin.isatty(): | |
+ sys.argv.append(sys.stdin.read()) | |
+ | |
command = sys.argv[1] if len(sys.argv) > 1 else None | |
args = sys.argv[2:] | |