Пример #1
0
 def run(cls, **kwargs):
     if kwargs['simple']:
         for pkg in sorted(dapicli.get_installed_daps()):
             print(pkg)
     else:
         for pkg, instances in sorted(dapicli.get_installed_daps_detailed().items()):
             versions = []
             for instance in instances:
                 location = utils.unexpanduser(instance['location'])
                 version = instance['version']
                 if not versions:  # if this is the first
                     version = utils.bold(version)
                 versions.append('{v}:{p}'.format(v=version, p=location))
             pkg = utils.bold(pkg)
             print('{pkg} ({versions})'.format(pkg=pkg, versions=' '.join(versions)))
Пример #2
0
def _format_dap_with_description(mdap):
    string = utils.bold(mdap['package_name'])
    latest = mdap['latest_stable'] or mdap['latest']
    if latest:
        latest = data(latest)
        string += ' - ' + latest['summary']
    return [string]
Пример #3
0
 def test_search(self, capfd):
     '''Test the print of a search results'''
     desired = utils.bold('python') + '\n'
     flexmock(dapicli).should_receive('data').and_return(yaml.load(TestDapicli.search_yaml))
     dapicli.print_search('python')
     out, err = capfd.readouterr()
     assert out == desired
Пример #4
0
def print_installed_dap_list(simple=False):
    '''Prints all installed DAPs in a human readable form to stdout'''
    if simple:
        for pkg in sorted(get_installed_daps()):
            print(pkg)
    else:
        for pkg, instances in sorted(get_installed_daps_detailed().items()):
            versions = []
            for instance in instances:
                location = utils.unexpanduser(instance['location'])
                version = instance['version']
                if not versions:  # if this is the first
                    version = utils.bold(version)
                versions.append('{v}:{p}'.format(v=version, p=location))
            pkg = utils.bold(pkg)
            print('{pkg} ({versions})'.format(pkg=pkg, versions=' '.join(versions)))
Пример #5
0
def _print_dap_with_description(mdap):
    print(utils.bold(mdap['package_name']), end='')
    latest = mdap['latest_stable'] or mdap['latest']
    if latest:
        latest = data(latest)
        print(' - ', end='')
        print(latest['summary'], end='')
    print('')
 def test_search_good_options(self):
     res = run_da('pkg search common_args --noassistants')
     assert utils.bold('common_args') in res.stdout
 def test_search(self):
     res = run_da('pkg search devassistant')
     assert utils.bold('devassistant') in res.stdout