Package zeroinstall :: Package cmd :: Module list
[frames] | no frames]

Source Code for Module zeroinstall.cmd.list

 1  """ 
 2  The B{0install list} command-line interface. 
 3  """ 
 4   
 5  # Copyright (C) 2011, Thomas Leonard 
 6  # See the README file for details, or visit http://0install.net. 
 7   
 8  from __future__ import print_function 
 9   
10  from zeroinstall.cmd import UsageError 
11   
12  syntax = "PATTERN" 
13   
14 -def add_options(parser):
15 pass
16
17 -def handle(config, options, args):
18 """@type config: L{zeroinstall.injector.config.Config} 19 @type args: [str]""" 20 if len(args) == 0: 21 matches = config.iface_cache.list_all_interfaces() 22 elif len(args) == 1: 23 match = args[0].lower() 24 matches = [i for i in config.iface_cache.list_all_interfaces() if match in i.lower()] 25 else: 26 raise UsageError() 27 28 matches.sort() 29 for i in matches: 30 print(i)
31