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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
use clap::{Parser, Subcommand};
#[derive(Parser)]
#[command(
name = "bv",
about = "A fast, project-scoped tool manager for bioinformatics",
version,
propagate_version = true
)]
pub struct Cli {
#[arg(short, long, global = true)]
pub verbose: bool,
#[command(subcommand)]
pub command: Commands,
}
#[derive(Subcommand)]
pub enum Commands {
/// Add one or more tools to bv.toml (and pull their images).
Add {
/// Tool identifiers, optionally with version (e.g. `blast blast@2.15.0 hmmer`).
#[arg(required = true)]
tools: Vec<String>,
/// Registry URL or local path. Overrides BV_REGISTRY env var and bv.toml.
#[arg(long, env = "BV_REGISTRY")]
registry: Option<String>,
/// Skip hardware requirement checks (useful on dev Macs for GPU tools).
#[arg(long)]
ignore_hardware: bool,
},
/// Remove a tool from bv.toml and bv.lock.
Remove {
/// Tool identifier.
tool: String,
},
/// Run a tool inside its container.
Run {
/// Tool identifier.
tool: String,
/// Arguments forwarded verbatim to the container entrypoint.
#[arg(last = true)]
args: Vec<String>,
},
/// List tools installed in this project.
List,
/// Show detailed information about an installed tool.
Info {
/// Tool identifier.
tool: String,
},
/// Resolve bv.toml and write (or check) bv.lock.
Lock {
/// Exit 1 if bv.lock would change; useful in CI.
#[arg(long)]
check: bool,
/// Registry URL or local path. Overrides BV_REGISTRY env var and bv.toml.
#[arg(long, env = "BV_REGISTRY")]
registry: Option<String>,
},
/// Pull every image in bv.lock, making the project runnable offline.
Sync {
/// Fail if bv.toml and bv.lock are not consistent with each other.
#[arg(long)]
frozen: bool,
/// Registry URL (used only for drift detection; optional).
#[arg(long, env = "BV_REGISTRY")]
registry: Option<String>,
},
/// Check that the environment is correctly configured.
Doctor,
/// Reference data management.
#[command(subcommand)]
Data(DataCommands),
/// Local cache management.
#[command(subcommand)]
Cache(CacheCommands),
}
#[derive(Subcommand)]
pub enum DataCommands {
/// Download one or more reference datasets from the registry.
Fetch {
/// Dataset identifiers, optionally with version (e.g. `pdbaa pdbaa@2024_01`).
#[arg(required = true)]
datasets: Vec<String>,
/// Registry URL or local path. Overrides BV_REGISTRY env var and bv.toml.
#[arg(long, env = "BV_REGISTRY")]
registry: Option<String>,
/// Skip the size confirmation prompt.
#[arg(long, short = 'y')]
yes: bool,
},
/// List reference datasets present in the local cache.
List,
}
#[derive(Subcommand)]
pub enum CacheCommands {
/// List (and optionally remove) images not referenced by any bv.lock.
Prune {
/// Actually remove images (default: dry run).
#[arg(long)]
apply: bool,
},
}