~unity-2d-team/unity-2d/Shell-MultiMonitor

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