rucksack/command/arg/
db.rs1use clap::Arg;
2
3pub fn path() -> Arg {
4 Arg::new("db")
5 .help("Path to the encrypted database to use")
6 .short('d')
7 .long("db")
8 .global(true)
9}
10
11pub fn pwd() -> Arg {
12 Arg::new("db-pass")
13 .help("Password used to encrypt the database")
14 .long("db-pass")
15 .global(true)
16}
17
18pub fn salt() -> Arg {
19 Arg::new("salt")
20 .help("The salt to use for encrypting the database")
21 .default_value(default_salt())
22 .short('s')
23 .long("salt")
24 .global(true)
25}
26
27fn default_salt() -> String {
28 match std::env::var("USER") {
29 Ok(user) => user,
30 Err(_) => "rucksack".to_string(),
31 }
32}
33
34pub fn not_needed() -> Arg {
35 Arg::new("db-needed")
36 .hide(true)
37 .long("db-needed")
38 .value_parser(clap::builder::BoolValueParser::new())
39 .default_value("false")
40 .global(true)
41}
42
43pub fn needed() -> Arg {
44 Arg::new("db-needed")
45 .hide(true)
46 .long("db-needed")
47 .value_parser(clap::builder::BoolValueParser::new())
48 .default_value("true")
49 .global(true)
50}
51
52pub fn serialised_format() -> Arg {
53 Arg::new("format")
54 .help("the de/serialisation format to use for import/export")
55 .long("format")
56 .value_parser(["", "chrome", "debug", "firefox"])
57 .global(true)
58}