2
by Aaron Bentley
Add skeleton grackle-put-message. |
1 |
#!/usr/bin/env python
|
2 |
import sys |
|
3 |
from grackle import client |
|
4 |
||
5 |
class UserError(Exception): |
|
6 |
"""An error caused by a user mistake."""
|
|
7 |
||
8 |
def main(*args): |
|
9 |
if len(args) != 1: |
|
10 |
raise UserError("Wrong number of arguments supplied.") |
|
11 |
client.put_message(args[0], sys.stdin) |
|
12 |
||
13 |
||
14 |
if __name__ == '__main__': |
|
15 |
try: |
|
16 |
main(*sys.argv[1:]) |
|
17 |
sys.exit(0) |
|
18 |
except UserError, e: |
|
19 |
sys.stderr.write(str(e) + '\n') |
|
20 |
sys.exit(1) |