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
use crate::common::util;
use std::path::PathBuf;
use structopt::StructOpt;
#[derive(Debug, Clone, StructOpt)]
#[structopt(author = "", rename_all = "kebab-case")]
pub struct Config {
#[structopt(short, long)]
pub verbose: bool,
#[structopt(short, long = "exclude", number_of_values = 1, parse(from_os_str))]
pub excludes: Vec<PathBuf>,
#[structopt(short, long = "tag", number_of_values = 1)]
pub tags: Vec<String>,
#[structopt(long, parse(from_os_str))]
pub dotfiles_path: Option<PathBuf>,
#[structopt(long)]
pub hostname: Option<String>,
#[structopt(subcommand)]
pub command: Command,
}
impl Config {
pub fn get() -> Self {
let res = Self::from_args();
util::set_verbosity(res.verbose);
res
}
}
#[derive(Debug, Clone, StructOpt)]
#[structopt(rename_all = "kebab-case")]
pub enum Command {
Ls,
#[structopt(name = "link")]
Link {
#[structopt(long)]
dry_run: bool,
},
}