Skip to main content

feed/
cli.rs

1use clap::{Parser, Subcommand};
2use std::path::PathBuf;
3
4#[derive(Parser)]
5#[command(
6    name = "feed",
7    about = "A simple RSS/Atom feed reader for the terminal"
8)]
9pub struct Cli {
10    #[command(subcommand)]
11    pub command: Option<Commands>,
12
13    /// Filter by feed name
14    #[arg(long)]
15    pub name: Option<String>,
16
17    /// Filter by tag
18    #[arg(long)]
19    pub tag: Option<String>,
20
21    /// Show cached articles only (no network access)
22    #[arg(long)]
23    pub cached: bool,
24
25    /// Show all articles (including read)
26    #[arg(long)]
27    pub all: bool,
28
29    /// Show articles from this date onwards (YYYY-MM-DD)
30    #[arg(long)]
31    pub from: Option<String>,
32
33    /// Use CLI output instead of TUI
34    #[arg(long)]
35    pub cli: bool,
36
37    /// Limit number of entries to display
38    #[arg(long, global = true)]
39    pub limit: Option<usize>,
40
41    /// Path to config file
42    #[arg(long, global = true)]
43    pub config: Option<PathBuf>,
44}
45
46#[derive(Subcommand)]
47pub enum Commands {
48    /// Fetch and display a feed by URL
49    FetchFeed {
50        /// Feed URL
51        url: String,
52    },
53    /// Fetch and display an article's text content
54    FetchArticle {
55        /// Article URL
56        url: String,
57    },
58    /// Register a new feed
59    Add {
60        /// Feed URL
61        url: String,
62
63        /// Display name for the feed (auto-detected if omitted)
64        #[arg(long)]
65        name: Option<String>,
66
67        /// Tag for the feed (can be specified multiple times)
68        #[arg(long, short)]
69        tag: Vec<String>,
70    },
71    /// Remove a registered feed
72    Remove {
73        /// Feed name or URL
74        target: String,
75    },
76    /// List registered feeds
77    List,
78    /// List all tags
79    Tags,
80}