
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)

[((15, 15, 15, 62), 'MultiLanguage.MultiLanguage.get_string', 'MultiLanguage.get_string', ({(15, 40, 15, 61): '"""FRAMEWORK_ADD_BRIEF"""'}, {}), "('FRAMEWORK_ADD_BRIEF')", False, 'from MultiLanguage import MultiLanguage\n'), ((30, 18, 30, 53), 'package.helper.ProjectHelper.get_current_project', 'ProjectHelper.get_current_project', ({}, {}), '()', False, 'from package.helper import ProjectHelper\n'), ((31, 8, 31, 50), 'package.helper.ProjectHelper.add_framework', 'ProjectHelper.add_framework', ({(31, 36, 31, 43): 'project', (31, 45, 31, 49): 'name'}, {}), '(project, name)', False, 'from package.helper import ProjectHelper\n'), ((23, 57, 23, 107), 'MultiLanguage.MultiLanguage.get_string', 'MultiLanguage.get_string', ({(23, 82, 23, 106): '"""FRAMEWORK_ADD_ARG_NAME"""'}, {}), "('FRAMEWORK_ADD_ARG_NAME')", False, 'from MultiLanguage import MultiLanguage\n')]