ipx add --list or --category updates a feed the catalogue already has (#107)
It refused one already there ("already subscribed as ..."), so a feed added before listing
existed, such as CBC's, could not be put in the Directory.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
13
src/main.rs
13
src/main.rs
@@ -686,6 +686,19 @@ async fn add(
|
||||
let url = &feed::find_feed(&ctx.client, &feed::expand_input(url)).await?;
|
||||
// Includes feeds derived from an OPML, or the same show could be added twice.
|
||||
if let Some(existing) = subscriptions(ctx).await?.iter().find(|s| feed::same_feed(&s.cfg.url, url)) {
|
||||
// Listing a feed the catalogue already has, or giving it a category, is the point of
|
||||
// asking again: it changes those, and nothing else.
|
||||
if let Some(f) = cfg.feeds.get_mut(&existing.id)
|
||||
&& (list || category.is_some())
|
||||
{
|
||||
f.listed |= list;
|
||||
if category.is_some() {
|
||||
f.category = category;
|
||||
}
|
||||
ctx.store_cfg(cfg).await?;
|
||||
println!("{} is already in the catalogue; updated its Directory listing", existing.id);
|
||||
return Ok(());
|
||||
}
|
||||
anyhow::bail!("already subscribed as {:?}", existing.id);
|
||||
}
|
||||
let id = add_one(ctx, &mut cfg, url, folder, keywords).await?;
|
||||
|
||||
Reference in New Issue
Block a user