
import cocos
from MultiLanguage import MultiLanguage

from package.helper import ProjectHelper


class FrameworkAdd(cocos.CCPlugin):
    @staticmethod
    def plugin_name():
        return "add-framework"

    @staticmethod
    def brief_description():
        return MultiLanguage.get_string('FRAMEWORK_ADD_BRIEF')

    # parse arguments
    def parse_args(self, argv):
        from argparse import ArgumentParser

        parser = ArgumentParser(prog="cocos %s" % self.__class__.plugin_name(),
                                description=self.__class__.brief_description())
        parser.add_argument("name", metavar="NAME", help=MultiLanguage.get_string('FRAMEWORK_ADD_ARG_NAME'))
        return parser.parse_args(argv)

    def run(self, argv):
        args = self.parse_args(argv)
        name = args.name

        project = ProjectHelper.get_current_project()
        ProjectHelper.add_framework(project, name)

[((269, 316), 'MultiLanguage.MultiLanguage.get_string', 'MultiLanguage.get_string', (['"""FRAMEWORK_ADD_BRIEF"""'], {}), "('FRAMEWORK_ADD_BRIEF')\n", (293, 316), False, 'from MultiLanguage import MultiLanguage\n'), ((832, 867), 'package.helper.ProjectHelper.get_current_project', 'ProjectHelper.get_current_project', ([], {}), '()\n', (865, 867), False, 'from package.helper import ProjectHelper\n'), ((876, 918), 'package.helper.ProjectHelper.add_framework', 'ProjectHelper.add_framework', (['project', 'name'], {}), '(project, name)\n', (903, 918), False, 'from package.helper import ProjectHelper\n'), ((634, 684), 'MultiLanguage.MultiLanguage.get_string', 'MultiLanguage.get_string', (['"""FRAMEWORK_ADD_ARG_NAME"""'], {}), "('FRAMEWORK_ADD_ARG_NAME')\n", (658, 684), False, 'from MultiLanguage import MultiLanguage\n')]