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

Source Code for Module zeroinstall.cmd.list_feeds

 1  """ 
 2  The B{0install list-feeds} 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 import _ 
11  from zeroinstall.cmd import UsageError 
12  from zeroinstall.injector import model, reader 
13   
14  syntax = "URI" 
15   
16 -def add_options(parser):
17 pass
18
19 -def handle(config, options, args):
20 """@type args: [str]""" 21 if len(args) != 1: raise UsageError() 22 uri = model.canonical_iface_uri(args[0]) 23 iface = config.iface_cache.get_interface(uri) 24 25 if iface.extra_feeds: 26 for f in iface.extra_feeds: 27 print(f.uri) 28 else: 29 print(_("(no feeds)"))
30 31 # Lists only interfaces with feeds. 32 # Note: this is also used by remove-feed.
33 -def complete(completion, args, cword):
34 """@type completion: L{zeroinstall.cmd._Completion} 35 @type args: [str] 36 @type cword: int""" 37 if len(args) != 1: return 38 iface_cache = completion.config.iface_cache 39 for uri in iface_cache.list_all_interfaces(): 40 dummy = model.Interface(uri) 41 reader.update_user_overrides(dummy) 42 if dummy.extra_feeds: 43 completion.add_filtered(uri)
44