# Path: will/utils.py
# def print_head():
#     puts(r"""
#       ___/-\___
#   ___|_________|___
#      |         |
#      |--O---O--|
#      |         |
#      |         |
#      |  \___/  |
#      |_________|
# 
#       Will: Hi!
# """)


import argparse
import os
import stat
import sys
from six.moves import input
from clint.textui import puts
from will.utils import print_head
    pass


def cleaned(service_name):
    return service_name.lower().replace(".", ''),


def ask_user(question):
    response = "?"
    while response not in ["y", "n"]:
        response = input("%s [y/n] " % question)
        if response not in ["y", "n"]:
            print("Please enter 'y' or 'n'.")
    return response.startswith("y")


def _enable_service(service_name, source):
    global requirements_txt
    source = source.replace('# "will.backends.io_adapters.%s"' % cleaned(service_name),
                            '"will.backends.io_adapters.%s"' % cleaned(service_name))
    req_path = os.path.join(os.path.join(PROJECT_ROOT, "..", "requirements"), "%s.txt" % cleaned(service_name))
    print(req_path)
    if os.path.exists(req_path):
        with open(req_path, 'r') as f:
            requirements_txt = "%s\n# %s\n%s" % (requirements_txt, service_name, f.read())
    return source


def __disable_service(service_name, source):
    return source.replace('"will.backends.io_adapters.%s"' % cleaned(service_name),

# Path: will/utils.py
# def print_head():
#     puts(r"""
#       ___/-\___
#   ___|_________|___
#      |         |
#      |--O---O--|
#      |         |
#      |         |
#      |  \___/  |
#      |_________|
# 
#       Will: Hi!
# """)


# Path: will/scripts/generate_will_project.py
import argparse
import os
import stat
import sys
from six.moves import input
from clint.textui import puts
from will.utils import print_head

    pass


def cleaned(service_name):
    return service_name.lower().replace(".", ''),


def ask_user(question):
    response = "?"
    while response not in ["y", "n"]:
        response = input("%s [y/n] " % question)
        if response not in ["y", "n"]:
            print("Please enter 'y' or 'n'.")
    return response.startswith("y")


def _enable_service(service_name, source):
    global requirements_txt
    source = source.replace('# "will.backends.io_adapters.%s"' % cleaned(service_name),
                            '"will.backends.io_adapters.%s"' % cleaned(service_name))
    req_path = os.path.join(os.path.join(PROJECT_ROOT, "..", "requirements"), "%s.txt" % cleaned(service_name))
    print(req_path)
    if os.path.exists(req_path):
        with open(req_path, 'r') as f:
            requirements_txt = "%s\n# %s\n%s" % (requirements_txt, service_name, f.read())
    return source


def __disable_service(service_name, source):
    return source.replace('"will.backends.io_adapters.%s"' % cleaned(service_name),

                          '"# will.backends.io_adapters.%s"' % cleaned(service_name))