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
use clap::{value_parser, Arg, ArgMatches};
const LONG_DECODE: &str = "Decode the lock name before printing it
Binary values will be written directly to standard output (which may do strange
things to your terminal)";
#[allow(missing_debug_implementations)]
pub struct SeaplaneLocksCommonArgMatches<'a>(pub &'a ArgMatches);
pub fn display_args() -> Vec<Arg<'static>> {
vec![
arg!(--decode - ('D'))
.help("Decode the lockname before printing it (WARNING! See --help)")
.long_help(LONG_DECODE)
.overrides_with("no-decode"),
arg!(--("no-decode"))
.help("Print lockname without decoding it")
.overrides_with("decode"),
arg!(--("no-header") | ("no-heading") | ("no-headers"))
.help("Omit the heading when printing with `--format=table`"),
]
}
pub fn base64() -> Arg<'static> {
arg!(--base64 - ('B')).help("The lockname is already encoded in URL safe Base64")
}
pub fn ttl() -> Arg<'static> {
arg!(--ttl - ('T') =["SECS"] required)
.value_parser(value_parser!(u32))
.help("The TTL (Time To Live) in seconds, i.e. a positive integer")
}
pub fn lock_id() -> Arg<'static> {
arg!(--("lock-id") - ('L') =["STRING"] required).help(
"A valid lock-id can be obtained from a successful acquisition, or listing of the locks",
)
}
pub fn lock_name() -> Arg<'static> {
arg!(lock_name =["LOCK_NAME"] required ).help("The name of the lock")
}