send_message: Accept subject and message arguments.

(imported from commit 93aca5e750fa74d7ee95d8a00adbf6d4e61b2fc8)
This commit is contained in:
Tim Abbott 2012-11-27 13:34:05 -05:00
parent fb0b4b23c3
commit 2f198a50c1
1 changed files with 6 additions and 4 deletions

View File

@ -25,16 +25,18 @@ import sys
from os import path from os import path
import optparse import optparse
usage = """send-message [options] <recipient> usage = """send-message [options] <recipients>
Sends a test message to the specified recipients. Sends a test message to the specified recipients.
Example: send-message --sender=you@example.com --type=stream commits Example: send-message --sender=you@example.com --type=stream commits --subject="my subject" --message="test message"
Example: send-message --sender=you@example.com --site=https://zephyr.humbughq.com user1@example.com user2@example.com Example: send-message --sender=you@example.com --site=https://zephyr.humbughq.com user1@example.com user2@example.com
""" """
parser = optparse.OptionParser(usage=usage) parser = optparse.OptionParser(usage=usage)
parser.add_option('--api-key') parser.add_option('--api-key')
parser.add_option('--sender') parser.add_option('--sender')
parser.add_option('--subject', default="test")
parser.add_option('--message', default="test message")
parser.add_option('--site', default='https://humbughq.com') parser.add_option('--site', default='https://humbughq.com')
parser.add_option('--type', default='private') parser.add_option('--type', default='private')
(options, args) = parser.parse_args() (options, args) = parser.parse_args()
@ -51,8 +53,8 @@ client = api.common.HumbugAPI(email=options.sender,
message_data = { message_data = {
"type": options.type, "type": options.type,
"content": "test", "content": options.message,
"subject": "test", "subject": options.subject,
"to": args, "to": args,
} }
print client.send_message(message_data) print client.send_message(message_data)