2 The B{0install remove-feed} command-line interface.
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
):
18 iface
= config
.iface_cache
.get_interface(model
.canonical_iface_uri(args
[0]))
20 feed_url
= model
.canonical_iface_uri(args
[1])
22 feed_url
= args
[1] # File might not exist any longer
24 feed_import
= add_feed
.find_feed_import(iface
, feed_url
)
26 raise SafeException(_('Interface %(interface)s has no feed %(feed)s') %
27 {'interface': iface
.uri
, 'feed': feed_url
})
28 iface
.extra_feeds
.remove(feed_import
)
29 writer
.save_interface(iface
)
31 add_feed
.handle(config
, options
, args
, add_ok
= False, remove_ok
= True)