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
|
use structopt::StructOpt;
use std::path::PathBuf;
#[derive(Debug, StructOpt)]
#[structopt(
author = "me",
name = "khalessi",
about = "Command line calendar tool."
)]
pub struct CommandLine {
/// verbosity
#[structopt(short = "v", parse(from_occurrences))]
pub verbosity: u64,
#[structopt(subcommand)]
pub cmd: Command,
}
#[derive(Debug, StructOpt)]
pub enum Command {
/// Show agenda view
#[structopt(name = "agenda")]
Agenda(Agenda),
/// Rebuild index
#[structopt(name = "index")]
Index(Index),
/// Copy event
#[structopt(name = "copy")]
Copy,
}
#[derive(Debug, StructOpt)]
pub struct Agenda {
/// Show agenda view
#[structopt(name = "args")]
pub args: Vec<String>,
}
#[derive(Debug, StructOpt)]
pub struct Index {
/// Rebuild index
#[structopt(short = "r", long = "reindex")]
pub reindex: bool,
/// index path
#[structopt(name = "path", parse(from_os_str))]
pub path: Option<PathBuf>,
}
|