-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcli.rs
56 lines (50 loc) · 1.57 KB
/
cli.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
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
use clap::Parser;
#[derive(Parser, Clone)]
pub(crate) struct CliArgs {
pkg: Option<String>,
#[clap(long, value_parser)]
discover: Option<usize>,
#[clap(long, value_parser)]
discover_start: Option<usize>,
/// Set a timeout in minutes after which the program will gracefully exit
#[clap(long, value_parser)]
timeout: Option<usize>,
#[clap(long, value_parser)]
/// The location of the generated output files.
output: Option<String>,
/// Generates completion for the specified shell.
#[clap(long, value_name = "SHELL", value_parser)]
generate_completion: Option<String>,
#[clap(long, value_parser)]
/// The map that is generated out of multiple input files.
generate_map: Option<String>,
/// The input map, that can be used for Lookup.
#[clap(long, value_parser)]
map: Option<String>,
}
impl CliArgs {
pub(crate) fn pkg(&self) -> Option<&String> {
self.pkg.as_ref()
}
pub(crate) fn discover(&self) -> Option<usize> {
self.discover
}
pub(crate) fn discover_start(&self) -> Option<usize> {
self.discover_start
}
pub(crate) fn generate_completion(&self) -> Option<&String> {
self.generate_completion.as_ref()
}
pub(crate) fn generate_map(&self) -> Option<&String> {
self.generate_map.as_ref()
}
pub(crate) fn map(&self) -> Option<&String> {
self.map.as_ref()
}
pub(crate) fn timeout(&self) -> Option<usize> {
self.timeout
}
pub(crate) fn output(&self) -> Option<String> {
self.output.clone()
}
}