yepzon-locationer/src/cmd.rs

49 lines
1.2 KiB
Rust
Raw Normal View History

2020-08-23 01:18:31 +02:00
use argh::FromArgs;
2020-08-24 01:51:59 +02:00
use std::path::PathBuf;
2020-08-23 01:18:31 +02:00
#[derive(FromArgs)]
#[argh(description = "Tool for gathering location data from Yepzon servers.")]
pub struct EnvOpt {
#[argh(subcommand)]
pub subcommand: Subcommand,
}
#[derive(FromArgs)]
#[argh(subcommand)]
pub enum Subcommand {
2020-08-24 02:33:40 +02:00
Since(SinceOpt),
2020-08-23 01:18:31 +02:00
Init(InitOpt),
}
#[derive(FromArgs)]
2020-08-24 02:33:40 +02:00
#[argh(
subcommand,
name = "since",
description = "fetch locations for a given section in time.\nsince and until in format dd.mm.yyy, OR hh:mm:ss, OR dd.mm.yyy-hh:mm:ss"
)]
pub struct SinceOpt {
2020-08-24 01:51:59 +02:00
#[argh(
option,
short = 'c',
2020-08-24 02:33:40 +02:00
description = "config.toml file path.",
2020-08-24 01:51:59 +02:00
default = "PathBuf::from(\"config.toml\")"
)]
pub config: PathBuf,
2020-08-24 02:33:40 +02:00
#[argh(
positional,
short = 's',
description = "the oldest point in time to get locations from."
)]
pub since: String,
#[argh(
option,
short = 'u',
description = "the most recent point in time to get locations from, default = now."
)]
pub until: Option<String>,
2020-08-24 01:51:59 +02:00
}
2020-08-23 01:18:31 +02:00
#[derive(FromArgs)]
2020-08-24 02:33:40 +02:00
#[argh(subcommand, name = "init", description = "initializes a config file")]
2020-08-23 01:18:31 +02:00
pub struct InitOpt {}