1use clap::ArgMatches;
2
3pub mod command;
4
5#[allow(clippy::cognitive_complexity)]
9#[must_use]
10pub fn clargs() -> ArgMatches {
11 use std::path::PathBuf;
12
13 use clap::{arg, command, value_parser, ArgAction, Command};
14
15 let command = command!()
16 .subcommand(
17 Command::new("init")
18 .about("Initialize the database tables")
19 .arg(
20 arg!(config: -c --config <FILE> "optional path to the configuration file")
21 .value_parser(value_parser!(PathBuf)),
22 ),
23 )
24 .subcommand(
25 Command::new("drop")
26 .about("Remove the database tables")
27 .arg(arg!(all: -a --all "remove tables for all coins").action(ArgAction::SetTrue))
28 .arg(
29 arg!(config: -c --config <FILE> "optional path to the configuration file")
30 .value_parser(value_parser!(PathBuf)),
31 ),
32 )
33 .subcommand(
34 Command::new("fetch")
35 .about("Fetch data from the origin")
36 .arg(
37 arg!(config: -c --config <FILE> "optional path to the configuration file")
38 .value_parser(value_parser!(PathBuf)),
39 ),
40 );
41
42 command.get_matches()
43}