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
use clap::{App, Arg, ArgSettings, SubCommand};

pub trait MathSubCommands {
    fn math_subcommands(self) -> Self;
}

impl MathSubCommands for App<'_, '_> {
    fn math_subcommands(self) -> Self {
        self.subcommand(
            SubCommand::with_name("math")
                .about("TODO")
                .alias("math")
                .subcommands(
                    vec![
                        SubCommand::with_name("tick-to-sqrt-price")
                            .arg(
                                Arg::with_name("tick")
                                    .index(1).set(ArgSettings::AllowLeadingHyphen)
                                    .value_name("TICK").required(true)
                            ),
                        SubCommand::with_name("sqrt-price-to-tick")
                            .arg(
                                Arg::with_name("price")
                                    .index(1).value_name("PRICE").required(true)
                            ),
                    ]
                )
        )
    }
}