#!/usr/bin/env python

from bcst.theme import *

import argparse

# if args.list:
#     for theme in list_themes():
#         print("- "+theme)
#     exit(0)
# elif args.extract:
#     t=Theme("default")
#     t.extract("resources.json")
#     exit(0)
# elif args.resource and args.destination:
#     t=Theme("default")
#     t.update_resource(args.resource)
#     t.deploy(args.destination)



args_parser = argparse.ArgumentParser()
args_parser.add_argument("-g", "--generate", nargs=3,metavar=("theme","resource","destination"), help="Generate a start page using a <theme> with a <resource> into the <destination> folder.")
args_parser.add_argument("-l","--list", dest="list",action="store_true", help="List available themes.")
args_parser.add_argument("-e","--extract", metavar="theme", help="Extract theme resource.")
args = args_parser.parse_args()

if args.generate :
    t=Theme(args.generate[0])
    t.update_resource(args.generate[1])
    t.generate(args.generate[2])
elif args.list:
    for theme in list_themes():
        print("- "+theme)
elif args.extract:
    t=Theme(args.extract)
    print(t.resource.content)
