コード例 #1
0
    def run(self, options, args):
        if not args:
            raise CommandError('Missing required argument (search query).')
        query = args
        pypi_hits = self.search(query, options)
        hits = transform_hits(pypi_hits)

        terminal_width = None
        if sys.stdout.isatty():
            terminal_width = get_terminal_size()[0]

        print_results(hits, terminal_width=terminal_width)
        if pypi_hits:
            return SUCCESS
        return NO_MATCHES_FOUND
コード例 #2
0
 def __init__(self, *args, **kwargs):
     # help position must be aligned with __init__.parseopts.description
     kwargs["max_help_position"] = 30
     kwargs["indent_increment"] = 1
     kwargs["width"] = get_terminal_size()[0] - 2
     optparse.IndentedHelpFormatter.__init__(self, *args, **kwargs)
コード例 #3
0
ファイル: parser.py プロジェクト: 2216288075/meiduo_project
 def __init__(self, *args, **kwargs):
     # help position must be aligned with __init__.parseopts.description
     kwargs['max_help_position'] = 30
     kwargs['indent_increment'] = 1
     kwargs['width'] = get_terminal_size()[0] - 2
     optparse.IndentedHelpFormatter.__init__(self, *args, **kwargs)