summaryrefslogtreecommitdiffstats
path: root/bin/domain/imag-timetrack/src/ui.rs
blob: 7f3c4d47060c412b4f4a0ffa8c203b1b88c127c4 (plain)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
//
// imag - the personal information management suite for the commandline
// Copyright (C) 2015, 2016 Matthias Beyer <mail@beyermatthias.de> and contributors
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; version
// 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
//

use clap::{Arg, App, SubCommand};

pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
    app
       .subcommand(SubCommand::with_name("list")
                   .about("List time trackings")
                   .version("0.1")
                   .arg(Arg::with_name("start-time")
                        .short("f")
                        .long("from")
                        .takes_value(true)
                        .multiple(false)
                        .required(false)
                        .help("Set earliest time from which on time trackings should be shown (use 'now' for current time)"))
                   .arg(Arg::with_name("end-time")
                        .short("t")
                        .long("to")
                        .takes_value(true)
                        .multiple(false)
                        .required(false)
                        .help("Set latest time of time trackings to be shown (use 'now' for current time)"))

                   .arg(Arg::with_name("list-not-ended")
                        .short("l")
                        .long("list-not-ended")
                        .takes_value(false)
                        .multiple(false)
                        .required(false)
                        .help("List not yet ended timetrackings even if after 'end-time'"))
                   )

       .subcommand(SubCommand::with_name("start")
                   .about("Start time tracking")
                   .version("0.1")
                   .arg(Arg::with_name("start-time")
                        .index(1)
                        .required(true)
                        .help("Start-time when to start the timetracking (use 'now' for current time)"))
                   .arg(Arg::with_name("tags")
                        .index(2)
                        .required(true)
                        .multiple(true)
                        .help("Tags to start"))
                   )

       .subcommand(SubCommand::with_name("stop")
                   .about("Stop time tracking")
                   .version("0.1")
                   .arg(Arg::with_name("end-time")
                        .index(1)
                        .required(false)
                        .help("End-time when to stop the timetracking (use 'now' for current time)"))
                   .arg(Arg::with_name("tags")
                        .index(2)
                        .required(false)
                        .multiple(true)
                        .help("Tags to stop"))
                   )

       .subcommand(SubCommand::with_name("track")
                   .about("Track time in given range")
                   .version("0.1")
                   .arg(Arg::with_name("start-time")
                        .index(1)
                        .required(true)
                        .help("Start-time when to start the timetracking"))
                   .arg(Arg::with_name("end-time")
                        .index(2)
                        .required(true)
                        .help("End-time when to stop the timetracking"))
                   .arg(Arg::with_name("tags")
                        .index(3)
                        .required(true)
                        .multiple(true)
                        .help("Tags to stop"))
                   )

       .subcommand(SubCommand::with_name("continue")
                   .about("Continue last stopped time tracking")
                   .version("0.1")
                   )

       .subcommand(SubCommand::with_name("day")
                   .about("Print stats about day")
                   .version("0.1")
                   .arg(Arg::with_name("start")
                        .index(1)
                        .required(false)
                        .help("Limit to specific date and time, start time (default: today, 00:00:00)"))
                   .arg(Arg::with_name("end")
                        .index(2)
                        .required(false)
                        .help("Limit to specific date and time, end time (default: today, 23:59:59)"))
                   .arg(Arg::with_name("tags")
                        .long("tags")
                        .short("t")
                        .required(false)
                        .multiple(true)
                        .help("Limit to certain tags"))
                   )

       .subcommand(SubCommand::with_name("week")
                   .about("Print stats about week")
                   .version("0.1")
                   .arg(Arg::with_name("start")
                        .index(1)
                        .required(false)
                        .help("Limit to specific date and time, start time (default: today, 00:00:00)"))
                   .arg(Arg::with_name("end")
                        .index(2)
                        .required(false)
                        .help("Limit to specific date and time, end time (default: today, 23:59:59)"))
                   .arg(Arg::with_name("tags")
                        .long("tags")
                        .short("t")
                        .required(false)
                        .multiple(true)
                        .help("Limit to certain tags"))
                   )

       .subcommand(SubCommand::with_name("month")
                   .about("Print stats about month")
                   .version("0.1")
                   .arg(Arg::with_name("start")
                        .index(1)
                        .required(false)
                        .help("Limit to specific date and time, start time (default: today, 00:00:00)"))
                   .arg(Arg::with_name("end")
                        .index(2)
                        .required(false)
                        .help("Limit to specific date and time, end time (default: today, 23:59:59)"))
                   .arg(Arg::with_name("tags")
                        .long("tags")
                        .short("t")
                        .required(false)
                        .multiple(true)
                        .help("Limit to certain tags"))
                   )

       .subcommand(SubCommand::with_name("year")
                   .about("Print stats about year")
                   .version("0.1")
                   .arg(Arg::with_name("start")
                        .index(1)
                        .required(false)
                        .help("Limit to specific date and time, start time (default: today, 00:00:00)"))
                   .arg(Arg::with_name("end")
                        .index(2)
                        .required(false)
                        .help("Limit to specific date and time, end time (default: today, 23:59:59)"))
                   .arg(Arg::with_name("tags")
                        .long("tags")
                        .short("t")
                        .required(false)
                        .multiple(true)
                        .help("Limit to certain tags"))
                   )

}