# Path: grace/utils.py
# def load_json(string):
#     obj = {}
# 
#     try:
#         obj = json.loads(string)
#     except ValueError as e:
#         raise e
# 
#     if sys.version_info.major < 3:
#         return _json_decode(obj)
# 
#     # if sys.version_info.major < 3:
#     #     d = _json_decode(obj)
#     #     if 'dizmo_settings' in d:
#     #         print(isinstance(d['dizmo_settings']['display_name'], str))
#     #         print(isinstance(d['dizmo_settings']['display_name'], unicode))
#     #         print(type(d['dizmo_settings']['display_name']))
#     #     return d
# 
#     return obj


from builtins import object
from .utils import load_json
import argparse
import textwrap
from __future__ import absolute_import


class CommandLineParser(object):
    def __init__(self):
        self._instantiate_parser()
        self._add_arguments()

    def _instantiate_parser(self):
        self._parser = argparse.ArgumentParser(description=textwrap.dedent(self._get_description()), epilog=textwrap.dedent(self._get_epilog()), formatter_class=argparse.RawDescriptionHelpFormatter)

    def _get_description(self):
        return '''\
Grace is a toolchain to work with rich JavaScript applications.
It provides several tools for developers to create applications
in a fast and clean manner.'''

    def _get_epilog(self):
        return '''\
Task Commands
-------------
The following tasks can be specified through the task command.
    build       Builds the project and places the output in ./build/ProjectName.
    deploy      First build and then deploy the project to the path
                specified in the deployment_path option in your project.cfg file.

# Path: grace/utils.py
# def load_json(string):
#     obj = {}
# 
#     try:
#         obj = json.loads(string)
#     except ValueError as e:
#         raise e
# 
#     if sys.version_info.major < 3:
#         return _json_decode(obj)
# 
#     # if sys.version_info.major < 3:
#     #     d = _json_decode(obj)
#     #     if 'dizmo_settings' in d:
#     #         print(isinstance(d['dizmo_settings']['display_name'], str))
#     #         print(isinstance(d['dizmo_settings']['display_name'], unicode))
#     #         print(type(d['dizmo_settings']['display_name']))
#     #     return d
# 
#     return obj


# Path: grace/cmdparse.py
from builtins import object
from .utils import load_json
import argparse
import textwrap

from __future__ import absolute_import


class CommandLineParser(object):
    def __init__(self):
        self._instantiate_parser()
        self._add_arguments()

    def _instantiate_parser(self):
        self._parser = argparse.ArgumentParser(description=textwrap.dedent(self._get_description()), epilog=textwrap.dedent(self._get_epilog()), formatter_class=argparse.RawDescriptionHelpFormatter)

    def _get_description(self):
        return '''\
Grace is a toolchain to work with rich JavaScript applications.
It provides several tools for developers to create applications
in a fast and clean manner.'''

    def _get_epilog(self):
        return '''\
Task Commands
-------------
The following tasks can be specified through the task command.
    build       Builds the project and places the output in ./build/ProjectName.
    deploy      First build and then deploy the project to the path
                specified in the deployment_path option in your project.cfg file.

    autodeploy  Execute a deploy task upon any change int the src directory.