From f77dff7cca03a0a09949ca1f9925a89485a6a48f Mon Sep 17 00:00:00 2001 From: ymgyt Date: Sat, 24 Aug 2024 19:52:52 +0900 Subject: [PATCH] doc: add description for import command --- README.md | 15 ++ backup.json | 292 +++++++++++++++++++++ crates/synd_term/src/cli/command/import.rs | 10 +- 3 files changed, 315 insertions(+), 2 deletions(-) create mode 100644 backup.json diff --git a/README.md b/README.md index cade2e17..a91004a1 100644 --- a/README.md +++ b/README.md @@ -281,6 +281,21 @@ You can check the JSON schema of the data to be exported with `synd export --pri ``` +### Import feeds + +You can subscribe to multiple feeds at once using the `synd import` command. +The input schema is the same as that of `synd export`. You can also check it with `synd import --print-schema`. + +``` +# from stdin +echo '{"feeds": [ {"url": "https://this-week-in-rust.org/atom.xml", "category": "rust", "requirement": "Must" } ]}' +| synd import - + +# read from file +synd export out> feeds.json +synd import feeds.json +``` + ### GitHub Notifications To enable GitHub notifications feature, specify the `--enable-github-notification | -G` flag or set the environment variable `SYND_ENABLE_GH=true`. diff --git a/backup.json b/backup.json new file mode 100644 index 00000000..9a5effbc --- /dev/null +++ b/backup.json @@ -0,0 +1,292 @@ +{ + "feeds": [ + { + "title": "κeenのHappy Hacκing Blog", + "url": "https://keens.github.io/index.xml", + "requirement": "Should", + "category": "rust" + }, + { + "title": "Cloud Native Computing Foundation", + "url": "https://www.cncf.io/feed/", + "requirement": "May", + "category": "cloud" + }, + { + "title": "Inside Rust Blog", + "url": "https://blog.rust-lang.org/inside-rust/feed.xml", + "requirement": "Must", + "category": "rust" + }, + { + "title": "Happy developing", + "url": "https://blog.ymgyt.io/atom.xml", + "requirement": "May", + "category": "rust" + }, + { + "title": "I hate reality", + "url": "https://blog.ihatereality.space/rss.xml", + "requirement": "Should", + "category": "rust" + }, + { + "title": "eBPF - The latest news, updates and articles covering eBPF and related topics.", + "url": "https://ebpf.io/blog/rss.xml", + "requirement": "Must", + "category": "ebpf" + }, + { + "title": "Cybernetist", + "url": "https://cybernetist.com/index.xml", + "requirement": "May", + "category": "rust" + }, + { + "title": "Without boats, dreams dry up", + "url": "https://without.boats/index.xml", + "requirement": "Should", + "category": "rust" + }, + { + "title": "observability news", + "url": "https://buttondown.email/o11y.news/rss", + "requirement": "Must", + "category": "opentelemetry" + }, + { + "title": "baby steps", + "url": "https://smallcultfollowing.com/babysteps/index.xml", + "requirement": "Should", + "category": "rust" + }, + { + "title": "The Embedded Rustacean Blog", + "url": "https://apollolabsblog.hashnode.dev/rss.xml", + "requirement": "May", + "category": "rust" + }, + { + "title": "crates.io: opentelemetry releases", + "url": "https://static.crates.io/rss/crates/opentelemetry.xml", + "requirement": "May", + "category": "rust" + }, + { + "title": "paild tech blog", + "url": "https://techblog.paild.co.jp/feed", + "requirement": "Should", + "category": "rust" + }, + { + "title": "Nushell", + "url": "https://www.nushell.sh/atom.xml", + "requirement": "Should", + "category": "nu" + }, + { + "title": "Terminal Trove", + "url": "https://terminaltrove.com/blog.xml", + "requirement": "May", + "category": "linux" + }, + { + "title": "Brendan Gregg's Blog", + "url": "https://www.brendangregg.com/blog/rss.xml", + "requirement": "Must", + "category": "linux" + }, + { + "title": "shift.click", + "url": "https://shift.click/feed.xml", + "requirement": "Should", + "category": "rust" + }, + { + "title": "2024 on OpenTelemetry", + "url": "https://opentelemetry.io/blog/2024/index.xml", + "requirement": "Must", + "category": "opentelemetry" + }, + { + "title": "OpenTelemetry グループの新着イベント", + "url": "https://opentelemetry.connpass.com/ja.atom", + "requirement": "Should", + "category": "opentelemetry" + }, + { + "title": "Rust Blog", + "url": "https://blog.rust-lang.org/feed.xml", + "requirement": "Must", + "category": "rust" + }, + { + "title": "Rust Magazine", + "url": "https://rustmagazine.org/feed.xml", + "requirement": "May", + "category": "rust" + }, + { + "title": "Mostly nerdless", + "url": "https://mostlynerdless.de/feed/", + "requirement": "Should", + "category": "ebpf" + }, + { + "title": "eBPF Meetup グループの新着イベント", + "url": "https://ebpf.connpass.com/ja.atom", + "requirement": "Must", + "category": "ebpf" + }, + { + "title": "O'Reilly Japan Ebook Store - New Release", + "url": "https://www.oreilly.co.jp/ebook/new_release.atom", + "requirement": "Should", + "category": "book" + }, + { + "title": "Determinate Systems", + "url": "https://determinate.systems/rss.xml", + "requirement": "Should", + "category": "nix" + }, + { + "title": "Julia Evans", + "url": "https://jvns.ca/atom.xml", + "requirement": "Should", + "category": "linux" + }, + { + "title": "Amazon EKS Document History", + "url": "https://docs.aws.amazon.com/eks/latest/userguide/doc-history.rss", + "requirement": "Should", + "category": "cloud" + }, + { + "title": "Kobzol’s blog", + "url": "https://kobzol.github.io/feed.xml", + "requirement": "Should", + "category": "rust" + }, + { + "title": "Publickey", + "url": "https://www.publickey1.jp/atom.xml", + "requirement": "May", + "category": "linux" + }, + { + "title": "Helix editor", + "url": "https://www.reddit.com/r/HelixEditor.rss", + "requirement": "May", + "category": "helix" + }, + { + "title": "Orhun's Blog", + "url": "https://blog.orhun.dev/rss.xml", + "requirement": "Should", + "category": "rust" + }, + { + "title": "Kubernetes Blog", + "url": "https://kubernetes.io/feed.xml", + "requirement": "Should", + "category": "kubernetes" + }, + { + "title": "COCl2's blog home", + "url": "https://blog.cocl2.com/index.xml", + "requirement": "Should", + "category": "rust" + }, + { + "title": "Aurorans Solis’ Blog", + "url": "https://auroranssolis.github.io/feed.xml", + "requirement": "Should", + "category": "rust" + }, + { + "title": "fasterthanli.me", + "url": "https://fasterthanli.me/index.xml", + "requirement": "Must", + "category": "rust" + }, + { + "title": "This Cute World", + "url": "https://thiscute.world/en/index.xml", + "requirement": "Must", + "category": "nix" + }, + { + "title": "axo blog", + "url": "https://blog.axo.dev/rss.xml", + "requirement": "Should", + "category": "rust" + }, + { + "title": "RustSec Advisories", + "url": "https://rustsec.org/feed.xml", + "requirement": "May", + "category": "rust" + }, + { + "title": "Kubernetes Vulnerability Announcements - CVE Feed", + "url": "https://kubernetes.io/docs/reference/issues-security/official-cve-feed/feed.xml", + "requirement": "May", + "category": "kubernetes" + }, + { + "title": "This Week in Rust", + "url": "https://this-week-in-rust.org/atom.xml", + "requirement": "Must", + "category": "rust" + }, + { + "title": "Xe Iaso's blog", + "url": "https://xeiaso.net/blog.json", + "requirement": "Should", + "category": "linux" + }, + { + "title": "AWS News Blog", + "url": "https://feeds.feedburner.com/AmazonWebServicesBlog", + "requirement": "May", + "category": "cloud" + }, + { + "title": "Byron Wasti - Posts", + "url": "https://www.byronwasti.com/atom.xml", + "requirement": "Should", + "category": "rust" + }, + { + "title": "David Lattimore’s Blog", + "url": "https://davidlattimore.github.io/feed.xml", + "requirement": "Must", + "category": "rust" + }, + { + "title": "seanmonstar", + "url": "https://seanmonstar.com/rss", + "requirement": "Should", + "category": "rust" + }, + { + "title": "/r/nix", + "url": "https://www.reddit.com/r/Nix.rss", + "requirement": "May", + "category": "nix" + }, + { + "title": "ゆううきブログ", + "url": "https://blog.yuuk.io/feed", + "requirement": "Should", + "category": "sre" + }, + { + "title": "Mara's Blog", + "url": "https://blog.m-ou.se/index.xml", + "requirement": "Must", + "category": "rust" + } + ] +} \ No newline at end of file diff --git a/crates/synd_term/src/cli/command/import.rs b/crates/synd_term/src/cli/command/import.rs index ee094b8d..39b54546 100644 --- a/crates/synd_term/src/cli/command/import.rs +++ b/crates/synd_term/src/cli/command/import.rs @@ -44,7 +44,7 @@ pub struct ImportCommand { cache_dir: PathBuf, /// Path to input file, '-' means stdin. #[arg()] - input: PathBuf, + input: Option, } impl ImportCommand { @@ -68,10 +68,16 @@ impl ImportCommand { } async fn import(self, endpoint: Url) -> anyhow::Result<()> { + let input = match self.input { + Some(input) => Self::read_input(input.as_path())?, + None => { + anyhow::bail!("input file path required") + } + }; let cx = PortContext::new(endpoint, self.cache_dir).await?; let import = Import { client: cx.client, - input: Self::read_input(self.input.as_path())?, + input, out: io::stdout(), interval: Duration::from_millis(500), };