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
use {
clap::{App, Arg},
super::farming::*,
super::math::*,
super::pair::*,
super::position::*,
super::ticks::*,
};
lazy_static! {
pub static ref CONFIG_FILE: Option<String> = {
dirs_next::home_dir().map(|mut path| {
path.extend(&[".config", "solana", "cli", "config.yml"]);
path.to_str().unwrap().to_string()
})
};
}
pub fn get_clap_app<'ab, 'v>(name: &str, about: &'ab str, version: &'ab str) -> App<'ab, 'v> {
App::new(name)
.about(about)
.version(version)
.arg(
{
let arg = Arg::with_name("config_file")
.short("C")
.long("config")
.value_name("CONFIG_FILE")
.global(true)
.takes_value(true)
.help("crema cli config, consistent with the solana cli config (default: $HOME/.config/solana/cli/config.yml)");
if let Some(ref config_file) = *CONFIG_FILE {
arg.default_value(config_file)
} else {
arg
}
}
)
.arg(
Arg::with_name("owner")
.short("o")
.long("owner")
.value_name("OWNER")
.global(true)
.takes_value(true)
.help("owner key")
)
.pair_subcommands()
.position_subcommands()
.math_subcommands()
.tick_subcommands()
.farming_subcommands()
}