romm_cli/commands/
scan.rs1use std::time::Duration;
4
5use anyhow::Result;
6use clap::Args;
7
8use crate::client::RommClient;
9
10use super::library_scan::{run_scan_library_flow, ScanCacheInvalidate, ScanLibraryOptions};
11use super::OutputFormat;
12
13#[derive(Args, Debug)]
14pub struct ScanCommand {
15 #[arg(long)]
17 pub wait: bool,
18
19 #[arg(long, requires = "wait")]
21 pub wait_timeout_secs: Option<u64>,
22}
23
24pub async fn handle(cmd: ScanCommand, client: &RommClient, format: OutputFormat) -> Result<()> {
25 let options = ScanLibraryOptions {
26 wait: cmd.wait,
27 wait_timeout: Duration::from_secs(cmd.wait_timeout_secs.unwrap_or(3600)),
28 cache_invalidate: if cmd.wait {
29 ScanCacheInvalidate::AllPlatforms
30 } else {
31 ScanCacheInvalidate::None
32 },
33 };
34 run_scan_library_flow(client, options, format).await
35}