示例#1
0
文件: ls-emails.py 项目: sjl421/pycr
    def run(self, arguments, *args, **kwargs):
        account_id = self.parse_command_line(arguments)

        try:
            account = Gerrit.get_account(account_id or 'self')
            emails = Gerrit.get_emails(account_id or 'self')

        except PyCRError as why:
            fail('cannot list account emails', why)

        table = PrettyTable(['Email', 'Preferred', 'Confirmed'])
        table.align = 'l'

        for email in emails:
            table.add_row([
                email.email,
                checkmark(True) if email.preferred else '',
                'No' if email.pending_confirmation else 'Yes'
            ])

        with Pager(command=self.name):
            print 'Account: {}'.format(account.username)
            if emails:
                print table
            else:
                print 'No email address'
示例#2
0
    def run(self, arguments, *args, **kwargs):
        account_id = self.parse_command_line(arguments)

        try:
            account = Gerrit.get_account(account_id or 'self')
            keys = Gerrit.get_ssh_keys(account_id or 'self')

        except PyCRError as why:
            fail('cannot list account SSH keys', why)

        table = PrettyTable(
            ['Id', 'Algorithm', 'Comment', 'Valid', 'Encoded key'])
        table.align = 'l'

        for key in keys:
            table.add_row([
                key.seq, key.algorithm, key.comment,
                checkmark(key.valid), key.encoded_key
            ])

        with Pager(command=self.name):
            print 'Account: {}'.format(account.username)
            if keys:
                print table
            else:
                print 'No SSH keys'
示例#3
0
    def run(self, arguments, *args, **kwargs):
        account_id = self.parse_command_line(arguments)

        try:
            account = Gerrit.get_account(account_id or 'self')
            prefs = Gerrit.get_diff_prefs(account_id or 'self')

        except PyCRError as why:
            fail('cannot list account diff preferences', why)

        table = PrettyTable(['Preference', 'Value'])
        table.align['Preference'] = 'l'
        table.align['Value'] = 'c'

        table.add_row(['Context', prefs.context])
        table.add_row(
            ['Expand all comments',
             checkmark(prefs.expand_all_comments)])
        table.add_row(['Ignore whitespace', prefs.ignore_whitespace])
        table.add_row(
            ['Intraline difference',
             checkmark(prefs.intraline_difference)])
        table.add_row(['Line length', prefs.line_length])
        table.add_row(['Manual review', checkmark(prefs.manual_review)])
        table.add_row(['Retain header', checkmark(prefs.retain_header)])
        table.add_row(
            ['Show line endings',
             checkmark(prefs.show_line_endings)])
        table.add_row(['Show tabs', checkmark(prefs.show_tabs)])
        table.add_row([
            'Show whitespace errors',
            checkmark(prefs.show_whitespace_errors)
        ])
        table.add_row(['Skip deleted', checkmark(prefs.skip_deleted)])
        table.add_row(['Skip uncommented', checkmark(prefs.skip_uncommented)])
        table.add_row(
            ['Syntax highlighting',
             checkmark(prefs.syntax_highlighting)])
        table.add_row(['Tab size', prefs.tab_size])

        with Pager(command=self.name):
            print 'Account: {}'.format(account.username)
            print table
示例#4
0
    def run(self, arguments, *args, **kwargs):
        account_id = self.parse_command_line(arguments)

        try:
            account = Gerrit.get_account(account_id or 'self')
            prefs = Gerrit.get_diff_prefs(account_id or 'self')

        except PyCRError as why:
            fail('cannot list account diff preferences', why)

        table = PrettyTable(['Preference', 'Value'])
        table.align['Preference'] = 'l'
        table.align['Value'] = 'c'

        table.add_row(['Context', prefs.context])
        table.add_row(['Expand all comments',
                       checkmark(prefs.expand_all_comments)])
        table.add_row(['Ignore whitespace', prefs.ignore_whitespace])
        table.add_row(['Intraline difference',
                       checkmark(prefs.intraline_difference)])
        table.add_row(['Line length', prefs.line_length])
        table.add_row(['Manual review', checkmark(prefs.manual_review)])
        table.add_row(['Retain header', checkmark(prefs.retain_header)])
        table.add_row(['Show line endings',
                       checkmark(prefs.show_line_endings)])
        table.add_row(['Show tabs', checkmark(prefs.show_tabs)])
        table.add_row(['Show whitespace errors',
                       checkmark(prefs.show_whitespace_errors)])
        table.add_row(['Skip deleted', checkmark(prefs.skip_deleted)])
        table.add_row(['Skip uncommented', checkmark(prefs.skip_uncommented)])
        table.add_row(['Syntax highlighting',
                       checkmark(prefs.syntax_highlighting)])
        table.add_row(['Tab size', prefs.tab_size])

        with Pager(command=self.name):
            print 'Account: {}'.format(account.username)
            print table
示例#5
0
    def run(self, arguments, *args, **kwargs):
        account_id = self.parse_command_line(arguments)

        try:
            groups = Gerrit.get_groups(account_id or 'self')

        except PyCRError as why:
            fail('cannot list account groups', why)

        table = PrettyTable(['Group', 'Description', 'Visible to all'])
        table.align = 'l'
        table.align['Visible to all'] = 'c'

        for group in groups:
            table.add_row([group.name, group.description or '',
                           checkmark(group.options.visible_to_all)])

        with Pager(command=self.name):
            print table
示例#6
0
文件: ls-groups.py 项目: sjl421/pycr
    def run(self, arguments, *args, **kwargs):
        account_id = self.parse_command_line(arguments)

        try:
            groups = Gerrit.get_groups(account_id or 'self')

        except PyCRError as why:
            fail('cannot list account groups', why)

        table = PrettyTable(['Group', 'Description', 'Visible to all'])
        table.align = 'l'
        table.align['Visible to all'] = 'c'

        for group in groups:
            table.add_row([
                group.name, group.description or '',
                checkmark(group.options.visible_to_all)
            ])

        with Pager(command=self.name):
            print table
示例#7
0
    def run(self, arguments, *args, **kwargs):
        account_id = self.parse_command_line(arguments)

        try:
            account = Gerrit.get_account(account_id or 'self')
            emails = Gerrit.get_emails(account_id or 'self')

        except PyCRError as why:
            fail('cannot list account emails', why)

        table = PrettyTable(['Email', 'Preferred', 'Confirmed'])
        table.align = 'l'

        for email in emails:
            table.add_row([email.email,
                           checkmark(True) if email.preferred else '',
                           'No' if email.pending_confirmation else 'Yes'])

        with Pager(command=self.name):
            print 'Account: {}'.format(account.username)
            if emails:
                print table
            else:
                print 'No email address'
示例#8
0
    def run(self, arguments, *args, **kwargs):
        account_id = self.parse_command_line(arguments)

        try:
            account = Gerrit.get_account(account_id or 'self')
            keys = Gerrit.get_ssh_keys(account_id or 'self')

        except PyCRError as why:
            fail('cannot list account SSH keys', why)

        table = PrettyTable(
            ['Id', 'Algorithm', 'Comment', 'Valid', 'Encoded key'])
        table.align = 'l'

        for key in keys:
            table.add_row([key.seq, key.algorithm, key.comment,
                           checkmark(key.valid), key.encoded_key])

        with Pager(command=self.name):
            print 'Account: {}'.format(account.username)
            if keys:
                print table
            else:
                print 'No SSH keys'
示例#9
0
    def run(self, arguments, *args, **kwargs):
        account_id = self.parse_command_line(arguments)

        try:
            account = Gerrit.get_account(account_id or 'self')
            capabilities = Gerrit.get_capabilities(account_id or 'self')

        except PyCRError as why:
            fail('cannot list account capabilities', why)

        table = PrettyTable(['Capability', 'Value'])
        table.align['Capability'] = 'l'
        table.align['Value'] = 'c'

        table.add_row(['Administrate server',
                       checkmark(capabilities.administrate_server)])
        table.add_row(['Min Query limit', capabilities.query_limit.min])
        table.add_row(['Max Query limit', capabilities.query_limit.max])
        table.add_row(['Create account',
                       checkmark(capabilities.create_account)])
        table.add_row(['Create group', checkmark(capabilities.create_group)])
        table.add_row(['Create project',
                       checkmark(capabilities.create_project)])
        table.add_row(['Email reviewers',
                       checkmark(capabilities.email_reviewers)])
        table.add_row(['Kill task', checkmark(capabilities.kill_task)])
        table.add_row(['View caches', checkmark(capabilities.view_caches)])
        table.add_row(['Flush caches', checkmark(capabilities.flush_caches)])
        table.add_row(['View connections',
                       checkmark(capabilities.view_connections)])
        table.add_row(['View queue', checkmark(capabilities.view_queue)])
        table.add_row(['Run GC', checkmark(capabilities.run_gc)])

        with Pager(command=self.name):
            print 'Account: {}'.format(account.username)
            print table