mirror of
https://github.com/netfun2000/ip2region.git
synced 2026-02-27 09:44:31 +08:00
28 lines
1019 B
Rust
28 lines
1019 B
Rust
use clap::{Arg, ArgMatches, Command};
|
|
|
|
pub fn get_matches() -> ArgMatches {
|
|
let db_arg = Arg::new("db")
|
|
.long("db")
|
|
.help("the xdb filepath, you can set this field like \
|
|
../data/ip2region.xdb,if you dont set,\
|
|
if will detect xdb file on ../data/ip2region.xdb, ../../data/ip2region.xdb, ../../../data/ip2region.xdb if exists");
|
|
|
|
Command::new("ip2region")
|
|
.version("0.1")
|
|
.about("ip2region bin program")
|
|
.long_about("you can set --db in command to specific the xdb filepath, default run query")
|
|
.subcommand(Command::new("query").about("query test").arg(&db_arg))
|
|
.subcommand(
|
|
Command::new("bench")
|
|
.about("bench test")
|
|
.arg(
|
|
Arg::new("src")
|
|
.long("src")
|
|
.help("set this to specific source bench file")
|
|
.required(true),
|
|
)
|
|
.arg(&db_arg),
|
|
)
|
|
.get_matches()
|
|
}
|