Special-case native Java version parsing
[zeroinstall.git] / zeroinstall / cmd / remove_feed.py
blob77af6217017b9252d4ed29e86493fcacf39c9d78
1 """
2 The B{0install remove-feed} command-line interface.
3 """
5 # Copyright (C) 2011, Thomas Leonard
6 # See the README file for details, or visit http://0install.net.
8 syntax = "[INTERFACE] FEED"
10 from zeroinstall import SafeException, _
11 from zeroinstall.injector import model, writer
12 from zeroinstall.cmd import add_feed, UsageError
14 add_options = add_feed.add_options
16 def handle(config, options, args):
17 if len(args) == 2:
18 iface = config.iface_cache.get_interface(model.canonical_iface_uri(args[0]))
19 feed_url = args[1]
21 feed_import = add_feed.find_feed_import(iface, feed_url)
22 if not feed_import:
23 raise SafeException(_('Interface %(interface)s has no feed %(feed)s') %
24 {'interface': iface.uri, 'feed': feed_url})
25 iface.extra_feeds.remove(feed_import)
26 writer.save_interface(iface)
27 elif len(args) == 1:
28 add_feed.handle(config, options, args, add_ok = False, remove_ok = True)
29 else:
30 raise UsageError()