eureka_manager_cli/commands/
download.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
pub mod chapter;
pub mod cover;
pub mod manga;

use clap::Subcommand;

use super::AsyncRun;

#[derive(Debug, Subcommand)]
pub enum DownloadSubCommands {
    /// Download Mangas subcommand
    Manga(manga::MangaDownloadArgs),
    /// Download Covers subcommand
    Cover(cover::CoverDownloadArgs),
    /// Download Chapters subcommand
    Chapter(chapter::ChapterDownloadArgs),
}

impl AsyncRun for DownloadSubCommands {
    async fn run(
        &self,
        manager: actix::Addr<eureka_mmanager::DownloadManager>,
    ) -> anyhow::Result<()> {
        match self {
            Self::Manga(r) => r.run(manager).await,
            Self::Cover(r) => r.run(manager).await,
            Self::Chapter(r) => r.run(manager).await,
        }
    }
}