#!/usr/bin/env python
"""
s3sync.

Usage:
  s3sync download <id> --bucket=<b> [--volume=<v> --volume=<v>]
  s3sync upload <id> --bucket=<b> [--volume=<v> --volume=<v>] [--redundancy=<r>]
  s3sync -h | --help
  s3sync --version

Options:
  -h --help         Show this screen.
  --version         Show version.
  --bucket=<b>      Bucket name to upload to.
  --redundancy=<r>  Upload multiple copies [default: 1].
"""
import sys

from docopt import docopt

# Run the program
if __name__ == '__main__':
    arguments = docopt(__doc__, version='s3sync 1.0')

    # Only import api if not running --help
    from api import upload, download

    try:
        if arguments.get('upload'):
            sys.exit(upload(arguments))
        elif arguments.get('download'):
            sys.exit(download(arguments))
        else:
            sys.exit(1)
    except Exception as e:
        print e.message
        sys.exit(1)
