#!/usr/bin/env python3

import argparse

usage = """create-user --new-email=<email address> --new-password=<password> --new-full-name=<full name> --new-short-name=<short name> [options]

Create a user. You must be a realm admin to use this API, and the user
will be created in your realm.

Example: create-user --new-email=jarthur@example.com --new-password=random17 --new-full-name 'J. Arthur Random' --new-short-name='jarthur'

Specify your Zulip API credentials and server in a ~/.zuliprc file or using the options.
"""

import zulip

parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage))
parser.add_argument('--new-email', required=True)
parser.add_argument('--new-password', required=True)
parser.add_argument('--new-full-name', required=True)
parser.add_argument('--new-short-name', required=True)
options = parser.parse_args()

client = zulip.init_from_options(options)

print(client.create_user({
    'email': options.new_email,
    'password': options.new_password,
    'full_name': options.new_full_name,
    'short_name': options.new_short_name
}))
