#!/usr/bin/env python
from botocore.exceptions import ClientError

from chalice_helpers import decrypt
from commandlines import Command
from ansi.colour import fg

c = Command()

if c.arg0 is None or c.arg0 == "":
    print(fg.boldred('You must provide a string to decrypt.'))
    exit(-1)


try:
    plaintext = decrypt(c.arg0)
except ClientError as client_error:
    print(client_error.response['Error']['Message'])
    exit(-1)

print(plaintext)