Пример #1
0
    def run(self, **options):
        name = slugify(options.get('profile'))
        project = options.get('project')

        if not name:
            self.red(texts.ERROR_PROFILE_INVALID_NAME.format(
                options.get('profile')
            ))
            return

        profile = Profile(name, project=project)

        if not profile.exists():
            self.red(texts.ERROR_PROFILE_DOESNT_EXIST.format(name))
            return

        profile.activate()
        self.green(texts.LOG_PROFILE_ACTIVATED.format(name))
Пример #2
0
    def run(self, **options):
        name = slugify(options.get('profile'))
        project = options.get('project')
        no_ignore = options.get('no_ignore')

        if not name:
            self.red(texts.ERROR_PROFILE_INVALID_NAME.format(
                options.get('profile')
            ))
            return

        profile = Profile(name, project=project, ignore_project=no_ignore)

        if profile.exists():
            self.red(texts.ERROR_PROFILE_EXISTS.format(name))
            return

        all_profiles = self.list_profiles(self.settings.get('path'))
        profile.create()
        self.green(texts.LOG_NEW_PROFILE.format(name))

        if options.get('active') or not all_profiles:
            profile.activate()
            self.green(texts.LOG_PROFILE_ACTIVATED.format(name))