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

« back to all changes in this revision

Viewing changes to grackle-put-message

  • Committer: Aaron Bentley
  • Date: 2012-01-10 11:06:36 UTC
  • Revision ID: aaron@canonical.com-20120110110636-fztfdo4gn1qfqty3
Add skeleton grackle-put-message.

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)