Added <command glob='...'> to support Debian multi-arch Java packages
[zeroinstall.git] / zeroinstall / cmd / list.py
blob834f424aa3dd5c2bbb76bb9fc45e5d68f9a07de2
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 __future__ import print_function
10 from zeroinstall.cmd import UsageError
12 syntax = "PATTERN"
14 def add_options(parser):
15 pass
17 def handle(config, options, args):
18 if len(args) == 0:
19 matches = config.iface_cache.list_all_interfaces()
20 elif len(args) == 1:
21 match = args[0].lower()
22 matches = [i for i in config.iface_cache.list_all_interfaces() if match in i.lower()]
23 else:
24 raise UsageError()
26 matches.sort()
27 for i in matches:
28 print(i)