use std::path::PathBuf; use clap::{Args, Parser, Subcommand}; pub use crate::options::since_cutoff; #[derive(Debug, Parser)] #[command( name = "longread", version, about = "Find long Bluesky self-threads worth turning into blog posts" )] pub struct Cli { #[command(subcommand)] pub command: Command, } #[derive(Debug, Subcommand)] pub enum Command { /// Rank long self-threads by length and engagement. Scan(ScanArgs), /// Scan the accounts a handle follows and merge the results. Follows(FollowsArgs), /// Write one thread as a Markdown draft. Export(ExportArgs), /// Show a publication's documents and the threads not yet in it. Publication(PublicationArgs), } #[derive(Debug, Clone, Args)] pub struct ThreadFilter { /// Only read posts newer than this (for example 90d, 12h or 365d). #[arg(long, default_value = "365d")] pub since: String, /// Minimum number of posts in a chain. #[arg(long, default_value_t = 5)] pub min_posts: usize, /// Minimum graphemes of text in a chain. #[arg(long, default_value_t = 1200)] pub min_graphemes: usize, /// Include chains that start as replies to someone else's post. #[arg(long)] pub include_replies: bool, /// Include threads already referenced by a site.standard.document. #[arg(long)] pub include_published: bool, } #[derive(Debug, Args)] pub struct ScanArgs { /// Handle or DID to scan. pub handle: String, #[command(flatten)] pub filter: ThreadFilter, /// Print JSON instead of a table. #[arg(long)] pub json: bool, } #[derive(Debug, Args)] pub struct FollowsArgs { /// Handle or DID whose follows to scan. pub handle: String, #[command(flatten)] pub filter: ThreadFilter, /// Maximum number of followed accounts to scan. #[arg(long, default_value_t = 200)] pub limit: usize, /// Print JSON instead of a table. #[arg(long)] pub json: bool, } #[derive(Debug, Args)] pub struct ExportArgs { /// bsky.app post URL or at-uri of any post in the thread. pub target: String, /// Write to this file instead of stdout. #[arg(long)] pub out: Option, } #[derive(Debug, Args)] pub struct PublicationArgs { /// Publication URL or at-uri. pub publication: String, #[command(flatten)] pub filter: ThreadFilter, /// Also scan the owner for threads not already in the publication. #[arg(long)] pub scan: bool, /// Print JSON instead of tables. #[arg(long)] pub json: bool, }