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
31
32
33
34
35
36
37
38
39
40
41
42
43
use anyhow::Result;
use clap::{Args, Subcommand};
use crate::db::{self, DbTier};
#[derive(Args)]
pub struct DbArgs {
#[command(subcommand)]
command: DbCommand,
}
#[derive(Subcommand)]
enum DbCommand {
/// Download and index a variant database.
Install {
/// Database tier: lite (ClinVar only), standard (+ gnomAD), full (+ dbSNP, PharmGKB).
#[arg(default_value = "standard")]
tier: DbTier,
},
/// Update databases to the latest release.
Update,
/// Show installed databases and versions.
Status,
/// Remove a specific database.
Remove {
/// Database to remove: clinvar, gnomad, dbsnp, pharmgkb, all.
database: String,
},
}
impl DbArgs {
pub async fn run(self) -> Result<()> {
match self.command {
DbCommand::Install { tier } => db::install(tier).await,
DbCommand::Update => db::update().await,
DbCommand::Status => db::status(),
DbCommand::Remove { database } => db::remove(&database),
}
}
}