bookdata/cli/goodreads/
mod.rs

1use crate::prelude::*;
2
3mod cluster;
4mod scan;
5mod work_gender;
6
7/// GoodReads processing commands.
8#[derive(Args, Debug)]
9pub struct Goodreads {
10    #[command(subcommand)]
11    command: GRCmd,
12}
13
14#[derive(clap::Subcommand, Debug)]
15enum GRCmd {
16    /// Scan GoodReads data.
17    Scan {
18        #[command(subcommand)]
19        data: scan::GRScan,
20    },
21    /// Cluster GoodReads intearaction data.
22    ClusterInteractions(cluster::CICommand),
23    /// Compute GoodReads work genders.
24    WorkGender,
25}
26
27impl Command for Goodreads {
28    fn exec(&self) -> Result<()> {
29        match &self.command {
30            GRCmd::Scan { data } => {
31                data.exec()?;
32            }
33            GRCmd::ClusterInteractions(opts) => {
34                opts.exec()?;
35            }
36            GRCmd::WorkGender => {
37                work_gender::link_work_genders()?;
38            }
39        }
40
41        Ok(())
42    }
43}