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

« back to all changes in this revision

Viewing changes to grackle-put-message

  • Committer: William Grant
  • Date: 2012-01-23 00:16:32 UTC
  • Revision ID: william.grant@canonical.com-20120123001632-z6dig91md7qu91f6
Date filtering.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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)