Преглед на файлове

Add a CLI utility to send commands to the sync client.

Mathias Gottschlag преди 6 години
родител
ревизия
bbeea9a8ec
променени са 5 файла, в които са добавени 434 реда и са изтрити 236 реда
  1. 254
    233
      Cargo.lock
  2. 5
    1
      Cargo.toml
  3. 99
    0
      src/bin/cli.rs
  4. 75
    1
      src/bin/client.rs
  5. 1
    1
      src/bin/server.rs

+ 254
- 233
Cargo.lock Целия файл

@@ -1,176 +1,188 @@
1 1
 # This file is automatically @generated by Cargo.
2 2
 # It is not intended for manual editing.
3 3
 [[package]]
4
-name = "autocfg"
5
-version = "0.1.7"
4
+name = "ansi_term"
5
+version = "0.11.0"
6 6
 source = "registry+https://github.com/rust-lang/crates.io-index"
7
+dependencies = [
8
+ "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
9
+]
7 10
 
8 11
 [[package]]
9
-name = "bitflags"
10
-version = "1.2.1"
12
+name = "arrayref"
13
+version = "0.3.5"
11 14
 source = "registry+https://github.com/rust-lang/crates.io-index"
12 15
 
13 16
 [[package]]
14
-name = "bytes"
15
-version = "0.5.3"
17
+name = "arrayvec"
18
+version = "0.5.1"
16 19
 source = "registry+https://github.com/rust-lang/crates.io-index"
17 20
 
18 21
 [[package]]
19
-name = "cfg-if"
20
-version = "0.1.10"
22
+name = "atty"
23
+version = "0.2.13"
21 24
 source = "registry+https://github.com/rust-lang/crates.io-index"
25
+dependencies = [
26
+ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
27
+ "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
28
+]
22 29
 
23 30
 [[package]]
24
-name = "fnv"
25
-version = "1.0.6"
31
+name = "backtrace"
32
+version = "0.3.40"
26 33
 source = "registry+https://github.com/rust-lang/crates.io-index"
34
+dependencies = [
35
+ "backtrace-sys 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
36
+ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
37
+ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
38
+ "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
39
+]
27 40
 
28 41
 [[package]]
29
-name = "fswatcher"
30
-version = "0.1.0"
42
+name = "backtrace-sys"
43
+version = "0.1.32"
44
+source = "registry+https://github.com/rust-lang/crates.io-index"
45
+dependencies = [
46
+ "cc 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)",
47
+ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
48
+]
31 49
 
32 50
 [[package]]
33
-name = "fuchsia-zircon"
34
-version = "0.3.3"
51
+name = "base64"
52
+version = "0.10.1"
35 53
 source = "registry+https://github.com/rust-lang/crates.io-index"
36 54
 dependencies = [
37
- "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
38
- "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
55
+ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
39 56
 ]
40 57
 
41 58
 [[package]]
42
-name = "fuchsia-zircon-sys"
43
-version = "0.3.3"
59
+name = "bitflags"
60
+version = "1.2.1"
44 61
 source = "registry+https://github.com/rust-lang/crates.io-index"
45 62
 
46 63
 [[package]]
47
-name = "futures-channel"
48
-version = "0.3.1"
64
+name = "blake2b_simd"
65
+version = "0.5.9"
49 66
 source = "registry+https://github.com/rust-lang/crates.io-index"
50 67
 dependencies = [
51
- "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
68
+ "arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
69
+ "arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
70
+ "constant_time_eq 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
52 71
 ]
53 72
 
54 73
 [[package]]
55
-name = "futures-core"
56
-version = "0.3.1"
74
+name = "byteorder"
75
+version = "1.3.2"
57 76
 source = "registry+https://github.com/rust-lang/crates.io-index"
58 77
 
59 78
 [[package]]
60
-name = "futures-sink"
61
-version = "0.3.1"
79
+name = "cc"
80
+version = "1.0.48"
62 81
 source = "registry+https://github.com/rust-lang/crates.io-index"
63 82
 
64 83
 [[package]]
65
-name = "futures-task"
66
-version = "0.3.1"
84
+name = "cfg-if"
85
+version = "0.1.10"
67 86
 source = "registry+https://github.com/rust-lang/crates.io-index"
68 87
 
69 88
 [[package]]
70
-name = "futures-util"
71
-version = "0.3.1"
89
+name = "clap"
90
+version = "2.33.0"
72 91
 source = "registry+https://github.com/rust-lang/crates.io-index"
73 92
 dependencies = [
74
- "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
75
- "futures-task 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
76
- "pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)",
93
+ "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
94
+ "atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
95
+ "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
96
+ "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
97
+ "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
98
+ "unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
99
+ "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
77 100
 ]
78 101
 
79 102
 [[package]]
80
-name = "h2"
81
-version = "0.2.1"
103
+name = "cloudabi"
104
+version = "0.0.3"
82 105
 source = "registry+https://github.com/rust-lang/crates.io-index"
83 106
 dependencies = [
84
- "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
85
- "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
86
- "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
87
- "futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
88
- "futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
89
- "http 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
90
- "indexmap 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
91
- "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
92
- "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
93
- "tokio 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
94
- "tokio-util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
107
+ "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
95 108
 ]
96 109
 
97 110
 [[package]]
98
-name = "http"
99
-version = "0.2.0"
111
+name = "constant_time_eq"
112
+version = "0.1.4"
100 113
 source = "registry+https://github.com/rust-lang/crates.io-index"
101
-dependencies = [
102
- "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
103
- "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
104
- "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
105
-]
106 114
 
107 115
 [[package]]
108
-name = "http-body"
109
-version = "0.3.1"
116
+name = "crossbeam-utils"
117
+version = "0.6.6"
110 118
 source = "registry+https://github.com/rust-lang/crates.io-index"
111 119
 dependencies = [
112
- "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
113
- "http 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
120
+ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
121
+ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
114 122
 ]
115 123
 
116 124
 [[package]]
117
-name = "httparse"
118
-version = "1.3.4"
125
+name = "dirs"
126
+version = "2.0.2"
119 127
 source = "registry+https://github.com/rust-lang/crates.io-index"
128
+dependencies = [
129
+ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
130
+ "dirs-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
131
+]
120 132
 
121 133
 [[package]]
122
-name = "hyper"
123
-version = "0.13.1"
134
+name = "dirs-sys"
135
+version = "0.3.4"
124 136
 source = "registry+https://github.com/rust-lang/crates.io-index"
125 137
 dependencies = [
126
- "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
127
- "futures-channel 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
128
- "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
129
- "futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
130
- "h2 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
131
- "http 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
132
- "http-body 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
133
- "httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
134
- "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
135
- "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
136
- "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
137
- "pin-project 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
138
- "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
139
- "tokio 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
140
- "tower-service 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
141
- "want 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
138
+ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
139
+ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
140
+ "redox_users 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
141
+ "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
142 142
 ]
143 143
 
144 144
 [[package]]
145
-name = "indexmap"
146
-version = "1.3.0"
145
+name = "failure"
146
+version = "0.1.6"
147 147
 source = "registry+https://github.com/rust-lang/crates.io-index"
148 148
 dependencies = [
149
- "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
149
+ "backtrace 0.3.40 (registry+https://github.com/rust-lang/crates.io-index)",
150
+ "failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
150 151
 ]
151 152
 
152 153
 [[package]]
153
-name = "iovec"
154
-version = "0.1.4"
154
+name = "failure_derive"
155
+version = "0.1.6"
155 156
 source = "registry+https://github.com/rust-lang/crates.io-index"
156 157
 dependencies = [
157
- "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
158
+ "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
159
+ "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
160
+ "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
161
+ "synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)",
158 162
 ]
159 163
 
160 164
 [[package]]
161
-name = "itoa"
162
-version = "0.4.4"
165
+name = "fswatcher"
166
+version = "0.1.0"
167
+
168
+[[package]]
169
+name = "fuchsia-cprng"
170
+version = "0.1.1"
163 171
 source = "registry+https://github.com/rust-lang/crates.io-index"
164 172
 
165 173
 [[package]]
166
-name = "kernel32-sys"
167
-version = "0.2.2"
174
+name = "heck"
175
+version = "0.3.1"
168 176
 source = "registry+https://github.com/rust-lang/crates.io-index"
169 177
 dependencies = [
170
- "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
171
- "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
178
+ "unicode-segmentation 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
172 179
 ]
173 180
 
181
+[[package]]
182
+name = "itoa"
183
+version = "0.4.4"
184
+source = "registry+https://github.com/rust-lang/crates.io-index"
185
+
174 186
 [[package]]
175 187
 name = "lazy_static"
176 188
 version = "1.4.0"
@@ -182,194 +194,214 @@ version = "0.2.66"
182 194
 source = "registry+https://github.com/rust-lang/crates.io-index"
183 195
 
184 196
 [[package]]
185
-name = "log"
186
-version = "0.4.8"
197
+name = "proc-macro-error"
198
+version = "0.2.6"
187 199
 source = "registry+https://github.com/rust-lang/crates.io-index"
188 200
 dependencies = [
189
- "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
201
+ "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
202
+ "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
203
+ "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
190 204
 ]
191 205
 
192 206
 [[package]]
193
-name = "memchr"
194
-version = "2.2.1"
207
+name = "proc-macro2"
208
+version = "1.0.6"
195 209
 source = "registry+https://github.com/rust-lang/crates.io-index"
210
+dependencies = [
211
+ "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
212
+]
196 213
 
197 214
 [[package]]
198
-name = "mio"
199
-version = "0.6.21"
215
+name = "quote"
216
+version = "1.0.2"
200 217
 source = "registry+https://github.com/rust-lang/crates.io-index"
201 218
 dependencies = [
202
- "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
203
- "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
204
- "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
205
- "iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
206
- "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
207
- "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
208
- "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
209
- "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
210
- "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
211
- "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
212
- "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
219
+ "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
213 220
 ]
214 221
 
215 222
 [[package]]
216
-name = "miow"
217
-version = "0.2.1"
223
+name = "rand_core"
224
+version = "0.3.1"
218 225
 source = "registry+https://github.com/rust-lang/crates.io-index"
219 226
 dependencies = [
220
- "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
221
- "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
222
- "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
223
- "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
227
+ "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
224 228
 ]
225 229
 
226 230
 [[package]]
227
-name = "net2"
228
-version = "0.2.33"
231
+name = "rand_core"
232
+version = "0.4.2"
233
+source = "registry+https://github.com/rust-lang/crates.io-index"
234
+
235
+[[package]]
236
+name = "rand_os"
237
+version = "0.1.3"
229 238
 source = "registry+https://github.com/rust-lang/crates.io-index"
230 239
 dependencies = [
231
- "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
240
+ "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
241
+ "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
232 242
  "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
243
+ "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
244
+ "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
233 245
  "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
234 246
 ]
235 247
 
236 248
 [[package]]
237
-name = "pin-project"
238
-version = "0.4.6"
249
+name = "rdrand"
250
+version = "0.4.0"
239 251
 source = "registry+https://github.com/rust-lang/crates.io-index"
240 252
 dependencies = [
241
- "pin-project-internal 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
253
+ "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
242 254
 ]
243 255
 
244 256
 [[package]]
245
-name = "pin-project-internal"
246
-version = "0.4.6"
257
+name = "redox_syscall"
258
+version = "0.1.56"
259
+source = "registry+https://github.com/rust-lang/crates.io-index"
260
+
261
+[[package]]
262
+name = "redox_users"
263
+version = "0.3.1"
247 264
 source = "registry+https://github.com/rust-lang/crates.io-index"
248 265
 dependencies = [
249
- "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
250
- "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
251
- "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
266
+ "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
267
+ "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
268
+ "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)",
269
+ "rust-argon2 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
252 270
 ]
253 271
 
254 272
 [[package]]
255
-name = "pin-project-lite"
256
-version = "0.1.1"
273
+name = "rust-argon2"
274
+version = "0.5.1"
257 275
 source = "registry+https://github.com/rust-lang/crates.io-index"
276
+dependencies = [
277
+ "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
278
+ "blake2b_simd 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
279
+ "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
280
+]
258 281
 
259 282
 [[package]]
260
-name = "pin-utils"
261
-version = "0.1.0-alpha.4"
283
+name = "rustc-demangle"
284
+version = "0.1.16"
262 285
 source = "registry+https://github.com/rust-lang/crates.io-index"
263 286
 
264 287
 [[package]]
265
-name = "proc-macro2"
266
-version = "1.0.6"
288
+name = "ryu"
289
+version = "1.0.2"
290
+source = "registry+https://github.com/rust-lang/crates.io-index"
291
+
292
+[[package]]
293
+name = "serde"
294
+version = "1.0.104"
267 295
 source = "registry+https://github.com/rust-lang/crates.io-index"
268 296
 dependencies = [
269
- "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
297
+ "serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
270 298
 ]
271 299
 
272 300
 [[package]]
273
-name = "quote"
274
-version = "1.0.2"
301
+name = "serde_derive"
302
+version = "1.0.104"
275 303
 source = "registry+https://github.com/rust-lang/crates.io-index"
276 304
 dependencies = [
277 305
  "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
306
+ "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
307
+ "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
278 308
 ]
279 309
 
280 310
 [[package]]
281
-name = "redox_syscall"
282
-version = "0.1.56"
311
+name = "serde_json"
312
+version = "1.0.44"
283 313
 source = "registry+https://github.com/rust-lang/crates.io-index"
314
+dependencies = [
315
+ "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
316
+ "ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
317
+ "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
318
+]
284 319
 
285 320
 [[package]]
286
-name = "slab"
287
-version = "0.4.2"
321
+name = "strsim"
322
+version = "0.8.0"
288 323
 source = "registry+https://github.com/rust-lang/crates.io-index"
289 324
 
290 325
 [[package]]
291
-name = "syn"
292
-version = "1.0.11"
326
+name = "structopt"
327
+version = "0.3.5"
293 328
 source = "registry+https://github.com/rust-lang/crates.io-index"
294 329
 dependencies = [
295
- "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
296
- "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
297
- "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
330
+ "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
331
+ "structopt-derive 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
298 332
 ]
299 333
 
300 334
 [[package]]
301
-name = "time"
302
-version = "0.1.42"
335
+name = "structopt-derive"
336
+version = "0.3.5"
303 337
 source = "registry+https://github.com/rust-lang/crates.io-index"
304 338
 dependencies = [
305
- "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
306
- "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)",
307
- "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
339
+ "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
340
+ "proc-macro-error 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
341
+ "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
342
+ "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
343
+ "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
308 344
 ]
309 345
 
310 346
 [[package]]
311
-name = "tokio"
312
-version = "0.2.6"
347
+name = "syn"
348
+version = "1.0.11"
313 349
 source = "registry+https://github.com/rust-lang/crates.io-index"
314 350
 dependencies = [
315
- "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
316
- "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
317
- "iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
318
- "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
319
- "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
320
- "mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)",
321
- "pin-project-lite 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
322
- "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
351
+ "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
352
+ "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
353
+ "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
323 354
 ]
324 355
 
325 356
 [[package]]
326
-name = "tokio-util"
327
-version = "0.2.0"
357
+name = "synstructure"
358
+version = "0.12.3"
328 359
 source = "registry+https://github.com/rust-lang/crates.io-index"
329 360
 dependencies = [
330
- "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
331
- "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
332
- "futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
333
- "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
334
- "pin-project-lite 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
335
- "tokio 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
361
+ "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
362
+ "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
363
+ "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
364
+ "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
336 365
 ]
337 366
 
338 367
 [[package]]
339
-name = "tower-service"
340
-version = "0.3.0"
341
-source = "registry+https://github.com/rust-lang/crates.io-index"
342
-
343
-[[package]]
344
-name = "try-lock"
345
-version = "0.2.2"
368
+name = "textwrap"
369
+version = "0.11.0"
346 370
 source = "registry+https://github.com/rust-lang/crates.io-index"
371
+dependencies = [
372
+ "unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
373
+]
347 374
 
348 375
 [[package]]
349 376
 name = "twfss"
350 377
 version = "0.1.0"
351 378
 dependencies = [
379
+ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
380
+ "dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
352 381
  "fswatcher 0.1.0",
353
- "hyper 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)",
382
+ "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
383
+ "serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)",
384
+ "structopt 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
354 385
 ]
355 386
 
356 387
 [[package]]
357
-name = "unicode-xid"
358
-version = "0.2.0"
388
+name = "unicode-segmentation"
389
+version = "1.6.0"
359 390
 source = "registry+https://github.com/rust-lang/crates.io-index"
360 391
 
361 392
 [[package]]
362
-name = "want"
363
-version = "0.3.0"
393
+name = "unicode-width"
394
+version = "0.1.7"
364 395
 source = "registry+https://github.com/rust-lang/crates.io-index"
365
-dependencies = [
366
- "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
367
- "try-lock 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
368
-]
369 396
 
370 397
 [[package]]
371
-name = "winapi"
372
-version = "0.2.8"
398
+name = "unicode-xid"
399
+version = "0.2.0"
400
+source = "registry+https://github.com/rust-lang/crates.io-index"
401
+
402
+[[package]]
403
+name = "vec_map"
404
+version = "0.8.1"
373 405
 source = "registry+https://github.com/rust-lang/crates.io-index"
374 406
 
375 407
 [[package]]
@@ -381,11 +413,6 @@ dependencies = [
381 413
  "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
382 414
 ]
383 415
 
384
-[[package]]
385
-name = "winapi-build"
386
-version = "0.1.1"
387
-source = "registry+https://github.com/rust-lang/crates.io-index"
388
-
389 416
 [[package]]
390 417
 name = "winapi-i686-pc-windows-gnu"
391 418
 version = "0.4.0"
@@ -396,63 +423,57 @@ name = "winapi-x86_64-pc-windows-gnu"
396 423
 version = "0.4.0"
397 424
 source = "registry+https://github.com/rust-lang/crates.io-index"
398 425
 
399
-[[package]]
400
-name = "ws2_32-sys"
401
-version = "0.2.1"
402
-source = "registry+https://github.com/rust-lang/crates.io-index"
403
-dependencies = [
404
- "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
405
- "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
406
-]
407
-
408 426
 [metadata]
409
-"checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2"
427
+"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
428
+"checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee"
429
+"checksum arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8"
430
+"checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90"
431
+"checksum backtrace 0.3.40 (registry+https://github.com/rust-lang/crates.io-index)" = "924c76597f0d9ca25d762c25a4d369d51267536465dc5064bdf0eb073ed477ea"
432
+"checksum backtrace-sys 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6575f128516de27e3ce99689419835fce9643a9b215a14d2b5b685be018491"
433
+"checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e"
410 434
 "checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
411
-"checksum bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "10004c15deb332055f7a4a208190aed362cf9a7c2f6ab70a305fba50e1105f38"
435
+"checksum blake2b_simd 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b83b7baab1e671718d78204225800d6b170e648188ac7dc992e9d6bddf87d0c0"
436
+"checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5"
437
+"checksum cc 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)" = "f52a465a666ca3d838ebbf08b241383421412fe7ebb463527bba275526d89f76"
412 438
 "checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
413
-"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3"
414
-"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
415
-"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
416
-"checksum futures-channel 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fcae98ca17d102fd8a3603727b9259fcf7fa4239b603d2142926189bc8999b86"
417
-"checksum futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "79564c427afefab1dfb3298535b21eda083ef7935b4f0ecbfcb121f0aec10866"
418
-"checksum futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "171be33efae63c2d59e6dbba34186fe0d6394fb378069a76dfd80fdcffd43c16"
419
-"checksum futures-task 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0bae52d6b29cf440e298856fec3965ee6fa71b06aa7495178615953fd669e5f9"
420
-"checksum futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c0d66274fb76985d3c62c886d1da7ac4c0903a8c9f754e8fe0f35a6a6cc39e76"
421
-"checksum h2 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b9433d71e471c1736fd5a61b671fc0b148d7a2992f666c958d03cd8feb3b88d1"
422
-"checksum http 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b708cc7f06493459026f53b9a61a7a121a5d1ec6238dee58ea4941132b30156b"
423
-"checksum http-body 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b"
424
-"checksum httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9"
425
-"checksum hyper 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8bf49cfb32edee45d890537d9057d1b02ed55f53b7b6a30bae83a38c9231749e"
426
-"checksum indexmap 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712d7b3ea5827fcb9d4fda14bf4da5f136f0db2ae9c8f4bd4e2d1c6fde4e6db2"
427
-"checksum iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e"
439
+"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9"
440
+"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
441
+"checksum constant_time_eq 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "995a44c877f9212528ccc74b21a232f66ad69001e40ede5bcee2ac9ef2657120"
442
+"checksum crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "04973fa96e96579258a5091af6003abde64af786b860f18622b82e026cca60e6"
443
+"checksum dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "13aea89a5c93364a98e9b37b2fa237effbb694d5cfe01c5b70941f7eb087d5e3"
444
+"checksum dirs-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "afa0b23de8fd801745c471deffa6e12d248f962c9fd4b4c33787b055599bde7b"
445
+"checksum failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f8273f13c977665c5db7eb2b99ae520952fe5ac831ae4cd09d80c4c7042b5ed9"
446
+"checksum failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0bc225b78e0391e4b8683440bf2e63c2deeeb2ce5189eab46e2b68c6d3725d08"
447
+"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
448
+"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205"
428 449
 "checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f"
429
-"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
430 450
 "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
431 451
 "checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558"
432
-"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
433
-"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e"
434
-"checksum mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)" = "302dec22bcf6bae6dfb69c647187f4b4d0fb6f535521f7bc022430ce8e12008f"
435
-"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919"
436
-"checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88"
437
-"checksum pin-project 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "94b90146c7216e4cb534069fb91366de4ea0ea353105ee45ed297e2d1619e469"
438
-"checksum pin-project-internal 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "44ca92f893f0656d3cba8158dd0f2b99b94de256a4a54e870bd6922fcc6c8355"
439
-"checksum pin-project-lite 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f0af6cbca0e6e3ce8692ee19fb8d734b641899e07b68eb73e9bbbd32f1703991"
440
-"checksum pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5894c618ce612a3fa23881b152b608bafb8c56cfc22f434a3ba3120b40f7b587"
452
+"checksum proc-macro-error 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "aeccfe4d5d8ea175d5f0e4a2ad0637e0f4121d63bd99d356fb1f39ab2e7c6097"
441 453
 "checksum proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9c9e470a8dc4aeae2dee2f335e8f533e2d4b347e1434e5671afc49b054592f27"
442 454
 "checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
455
+"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
456
+"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
457
+"checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071"
458
+"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
443 459
 "checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"
444
-"checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
460
+"checksum redox_users 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4ecedbca3bf205f8d8f5c2b44d83cd0690e39ee84b951ed649e9f1841132b66d"
461
+"checksum rust-argon2 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4ca4eaef519b494d1f2848fc602d18816fed808a981aedf4f1f00ceb7c9d32cf"
462
+"checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783"
463
+"checksum ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfa8506c1de11c9c4e4c38863ccbe02a305c8188e85a05a784c9e11e1c3910c8"
464
+"checksum serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "414115f25f818d7dfccec8ee535d76949ae78584fc4f79a6f45a904bf8ab4449"
465
+"checksum serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "128f9e303a5a29922045a830221b8f78ec74a5f544944f3d5984f8ec3895ef64"
466
+"checksum serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)" = "48c575e0cc52bdd09b47f330f646cf59afc586e9c4e3ccd6fc1f625b8ea1dad7"
467
+"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
468
+"checksum structopt 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "30b3a3e93f5ad553c38b3301c8a0a0cec829a36783f6a0c467fc4bf553a5f5bf"
469
+"checksum structopt-derive 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea692d40005b3ceba90a9fe7a78fa8d4b82b0ce627eebbffc329aab850f3410e"
445 470
 "checksum syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "dff0acdb207ae2fe6d5976617f887eb1e35a2ba52c13c7234c790960cdad9238"
446
-"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f"
447
-"checksum tokio 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0e1bef565a52394086ecac0a6fa3b8ace4cb3a138ee1d96bd2b93283b56824e3"
448
-"checksum tokio-util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "571da51182ec208780505a32528fc5512a8fe1443ab960b3f2f3ef093cd16930"
449
-"checksum tower-service 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860"
450
-"checksum try-lock 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382"
471
+"checksum synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545"
472
+"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
473
+"checksum unicode-segmentation 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0"
474
+"checksum unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479"
451 475
 "checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
452
-"checksum want 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0"
453
-"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
476
+"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a"
454 477
 "checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6"
455
-"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
456 478
 "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
457 479
 "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
458
-"checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"

+ 5
- 1
Cargo.toml Целия файл

@@ -6,4 +6,8 @@ edition = "2018"
6 6
 
7 7
 [dependencies]
8 8
 fswatcher = { path = "./fswatcher" }
9
-hyper = "0.13"
9
+structopt = "0.3"
10
+serde = { version = "1.0", features = ["derive"] }
11
+serde_json = "1.0"
12
+dirs = "2.0"
13
+byteorder = "1.3"

+ 99
- 0
src/bin/cli.rs Целия файл

@@ -0,0 +1,99 @@
1
+use std::io::{self, Write};
2
+use std::net::Shutdown;
3
+use std::os::unix::net::UnixStream;
4
+use std::path::PathBuf;
5
+
6
+use byteorder::{BigEndian, ReadBytesExt};
7
+use serde::{Deserialize, Serialize};
8
+use structopt::StructOpt;
9
+
10
+const SOCKET_PATH: &str = "$HOME/.twfss/sock";
11
+
12
+pub fn socket_path() -> String {
13
+    SOCKET_PATH
14
+        .to_owned()
15
+        .replace("$HOME", dirs::home_dir().unwrap().to_str().unwrap())
16
+}
17
+
18
+#[derive(StructOpt, Serialize, Deserialize)]
19
+#[structopt(about = "CLI for the two-way file system sync client")]
20
+pub struct Options {
21
+    #[structopt(long)]
22
+    pub verbose: bool,
23
+    #[structopt(subcommand)]
24
+    pub command: Command,
25
+}
26
+
27
+#[derive(StructOpt, Serialize, Deserialize)]
28
+pub enum Command {
29
+    ListDirectories {
30
+        status: bool,
31
+    },
32
+    AddDirectory {
33
+        local_directory: PathBuf,
34
+        remote_url: String,
35
+    },
36
+    RemoveDirectory {
37
+        local_directory: PathBuf,
38
+    },
39
+}
40
+
41
+// The file is included in the sync client, where main() is unused.
42
+#[allow(unused)]
43
+fn main() {
44
+    let options = Options::from_args();
45
+
46
+    // We simply send the options to the server and print whatever the server returns.
47
+    let mut client = match SyncClient::connect() {
48
+        Ok(client) => client,
49
+        Err(err) => {
50
+            println!(
51
+                "Could not connect to the sync client. Make sure that the sync client is running."
52
+            );
53
+            println!("Error: {:?}", err);
54
+            std::process::exit(-1);
55
+        }
56
+    };
57
+    let return_code = client.execute(options).unwrap();
58
+    std::process::exit(return_code);
59
+}
60
+
61
+struct SyncClient {
62
+    stream: UnixStream,
63
+}
64
+
65
+impl SyncClient {
66
+    fn connect() -> Result<SyncClient, Error> {
67
+        let stream = UnixStream::connect(socket_path()).unwrap();
68
+        Ok(SyncClient { stream })
69
+    }
70
+
71
+    fn execute(&mut self, options: Options) -> Result<i32, Error> {
72
+        let json = serde_json::to_string(&options)?;
73
+        self.stream.write_all(json.as_bytes())?;
74
+        self.stream.shutdown(Shutdown::Write).unwrap();
75
+        // The first 4 bytes are the return value.
76
+        let return_value = self.stream.read_i32::<BigEndian>()?;
77
+        // Print all the output returned by the server.
78
+        io::copy(&mut self.stream, &mut io::stdout())?;
79
+        Ok(return_value)
80
+    }
81
+}
82
+
83
+#[derive(Debug)]
84
+enum Error {
85
+    Json(serde_json::error::Error),
86
+    Io(std::io::Error),
87
+}
88
+
89
+impl From<serde_json::error::Error> for Error {
90
+    fn from(e: serde_json::error::Error) -> Error {
91
+        Error::Json(e)
92
+    }
93
+}
94
+
95
+impl From<io::Error> for Error {
96
+    fn from(e: io::Error) -> Error {
97
+        Error::Io(e)
98
+    }
99
+}

+ 75
- 1
src/bin/client.rs Целия файл

@@ -1,3 +1,77 @@
1
+use std::io::{self, Read, Write};
2
+use std::os::unix::net::{UnixListener, UnixStream};
3
+use std::thread;
4
+
5
+mod cli;
6
+
1 7
 fn main() {
2
-    println!("Hello, world!");
8
+    // Initialize the existing synchronized directories.
9
+    // TODO
10
+
11
+    // TODO: Register signal handler for graceful shutdown.
12
+
13
+    // Listen for CLI commands.
14
+    // TODO: Graceful shutdown on errors.
15
+    let listener = UnixListener::bind(cli::socket_path()).unwrap();
16
+    for stream in listener.incoming() {
17
+        match stream {
18
+            Ok(stream) => {
19
+                thread::spawn(move || {
20
+                    let mut stream = stream;
21
+                    match handle_cli_client(&mut stream) {
22
+                        Ok(()) => {}
23
+                        Err(e) => {
24
+                            // Log error and try to send it to the stream.
25
+                            // TODO
26
+                            write!(stream, "Error: {:?}", e).ok();
27
+                        }
28
+                    };
29
+                });
30
+            }
31
+            Err(err) => {
32
+                eprintln!("Error while listening on the local unix socket: {:?}", err);
33
+                break;
34
+            }
35
+        }
36
+    }
37
+}
38
+
39
+fn handle_cli_client(stream: &mut UnixStream) -> Result<(), Error> {
40
+    let mut request = String::new();
41
+    stream.read_to_string(&mut request)?;
42
+
43
+    let options: cli::Options = serde_json::from_str(&request)?;
44
+    let _verbose = options.verbose;
45
+    match options.command {
46
+        _cmd @ cli::Command::ListDirectories { .. } => {
47
+            // TODO
48
+        }
49
+        _cmd @ cli::Command::AddDirectory { .. } => {
50
+            // TODO
51
+        }
52
+        _cmd @ cli::Command::RemoveDirectory { .. } => {
53
+            // TODO
54
+        }
55
+    }
56
+
57
+    // TODO
58
+    Ok(())
59
+}
60
+
61
+#[derive(Debug)]
62
+enum Error {
63
+    Json(serde_json::error::Error),
64
+    Io(std::io::Error),
65
+}
66
+
67
+impl From<serde_json::error::Error> for Error {
68
+    fn from(e: serde_json::error::Error) -> Error {
69
+        Error::Json(e)
70
+    }
71
+}
72
+
73
+impl From<io::Error> for Error {
74
+    fn from(e: io::Error) -> Error {
75
+        Error::Io(e)
76
+    }
3 77
 }

+ 1
- 1
src/bin/server.rs Целия файл

@@ -1,3 +1,3 @@
1 1
 fn main() {
2
-    println!("Hello, world!");
2
+    // TODO
3 3
 }

Loading…
Отказ
Запис