Made a proper Config object
[zeroinstall/zeroinstall-afb.git] / zeroinstall / cmd / list.py
blob6d3a970271af301e4080617ac2fcb93c552e1ebb
1 """
2 The B{0install list} command-line interface.
3 """
5 # Copyright (C) 2011, Thomas Leonard
6 # See the README file for details, or visit http://0install.net.
8 from zeroinstall.cmd import UsageError
10 syntax = "PATTERN"
12 def add_options(parser):
13 pass
15 def handle(config, options, args):
16 if len(args) == 0:
17 matches = config.iface_cache.list_all_interfaces()
18 elif len(args) == 1:
19 match = args[0].lower()
20 matches = [i for i in config.iface_cache.list_all_interfaces() if match in i.lower()]
21 else:
22 raise UsageError()
24 matches.sort()
25 for i in matches:
26 print i