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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
use clap::{App, Arg, ArgSettings, SubCommand};
pub trait TickSubCommand {
fn tick_subcommands(self) -> Self;
}
impl TickSubCommand for App<'_, '_> {
fn tick_subcommands(self) -> Self {
self.subcommand(
SubCommand::with_name("ticks")
.about("retrive info about tick array, tick, tick map, tick price, array index.")
.alias("ticks")
.subcommands(vec![
SubCommand::with_name("tick")
.about("retrive one tick info")
.args(&[
Arg::with_name("pool")
.index(1)
.value_name("POOL")
.required(true)
.help("The pool to see tick info"),
Arg::with_name("tick_index")
.short("t")
.set(ArgSettings::AllowLeadingHyphen)
.long("tick_index")
.value_name("TICK_INDEX")
.required(true)
.help("The tick index"),
]),
SubCommand::with_name("array")
.about("tick array info")
.args(&[
Arg::with_name("pool")
.index(1)
.value_name("POOL")
.required(true)
.help("The pool to see tick info"),
Arg::with_name("tick_index")
.short("t")
.set(ArgSettings::AllowLeadingHyphen)
.long("tick_index")
.value_name("TICK_INDEX")
.global(true)
.takes_value(true)
.help("the tick array contains this tick index"),
Arg::with_name("array_index")
.short("a")
.set(ArgSettings::AllowLeadingHyphen)
.long("array_index")
.value_name("ARRAY_INDEX")
.global(true)
.takes_value(true)
.help("The array index"),
]),
SubCommand::with_name("map")
.about("tick array map info")
.args(&[
Arg::with_name("pool")
.index(1)
.value_name("POOL")
.required(true)
.help("The clmmpool"),
Arg::with_name("array_index")
.index(2)
.set(ArgSettings::AllowLeadingHyphen)
.value_name("ARRAY_INDEX")
.required(true)
.help("The array index"),
]),
SubCommand::with_name("price")
.about("tick to price")
.args(&[Arg::with_name("tick")
.short("t")
.set(ArgSettings::AllowLeadingHyphen)
.value_name("tick")
.required(true)
.help("The tick index")]),
SubCommand::with_name("index")
.about("given tick index, return array_index and tick range")
.args(&[
Arg::with_name("tick_index")
.short("t")
.set(ArgSettings::AllowLeadingHyphen)
.value_name("tick index")
.required(true)
.help("The tick index"),
Arg::with_name("tick_spacing")
.short("s")
.set(ArgSettings::AllowLeadingHyphen)
.value_name("tick spacing")
.required(true)
.help("The tick spacing"),
]),
]),
)
}
}