diff options
-rw-r--r-- | Cargo.lock | 357 | ||||
-rw-r--r-- | src/main.rs | 83 |
2 files changed, 49 insertions, 391 deletions
diff --git a/Cargo.lock b/Cargo.lock deleted file mode 100644 index cb43b18..0000000 --- a/Cargo.lock +++ /dev/null | |||
@@ -1,357 +0,0 @@ | |||
1 | [[package]] | ||
2 | name = "argon2rs" | ||
3 | version = "0.2.5" | ||
4 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
5 | dependencies = [ | ||
6 | "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", | ||
7 | "scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", | ||
8 | ] | ||
9 | |||
10 | [[package]] | ||
11 | name = "arrayvec" | ||
12 | version = "0.4.10" | ||
13 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
14 | dependencies = [ | ||
15 | "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", | ||
16 | ] | ||
17 | |||
18 | [[package]] | ||
19 | name = "autocfg" | ||
20 | version = "0.1.2" | ||
21 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
22 | |||
23 | [[package]] | ||
24 | name = "backtrace" | ||
25 | version = "0.3.14" | ||
26 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
27 | dependencies = [ | ||
28 | "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||
29 | "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", | ||
30 | "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", | ||
31 | "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", | ||
32 | "rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", | ||
33 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", | ||
34 | ] | ||
35 | |||
36 | [[package]] | ||
37 | name = "backtrace-sys" | ||
38 | version = "0.1.28" | ||
39 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
40 | dependencies = [ | ||
41 | "cc 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", | ||
42 | "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", | ||
43 | ] | ||
44 | |||
45 | [[package]] | ||
46 | name = "bitflags" | ||
47 | version = "1.0.4" | ||
48 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
49 | |||
50 | [[package]] | ||
51 | name = "blake2-rfc" | ||
52 | version = "0.2.18" | ||
53 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
54 | dependencies = [ | ||
55 | "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", | ||
56 | "constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", | ||
57 | ] | ||
58 | |||
59 | [[package]] | ||
60 | name = "cc" | ||
61 | version = "1.0.31" | ||
62 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
63 | |||
64 | [[package]] | ||
65 | name = "cfg-if" | ||
66 | version = "0.1.7" | ||
67 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
68 | |||
69 | [[package]] | ||
70 | name = "cloudabi" | ||
71 | version = "0.0.3" | ||
72 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
73 | dependencies = [ | ||
74 | "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", | ||
75 | ] | ||
76 | |||
77 | [[package]] | ||
78 | name = "constant_time_eq" | ||
79 | version = "0.1.3" | ||
80 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
81 | |||
82 | [[package]] | ||
83 | name = "dirs" | ||
84 | version = "1.0.5" | ||
85 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
86 | dependencies = [ | ||
87 | "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", | ||
88 | "redox_users 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
89 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", | ||
90 | ] | ||
91 | |||
92 | [[package]] | ||
93 | name = "eva" | ||
94 | version = "0.1.0" | ||
95 | dependencies = [ | ||
96 | "rustyline 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
97 | ] | ||
98 | |||
99 | [[package]] | ||
100 | name = "failure" | ||
101 | version = "0.1.5" | ||
102 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
103 | dependencies = [ | ||
104 | "backtrace 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", | ||
105 | "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", | ||
106 | ] | ||
107 | |||
108 | [[package]] | ||
109 | name = "failure_derive" | ||
110 | version = "0.1.5" | ||
111 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
112 | dependencies = [ | ||
113 | "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", | ||
114 | "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", | ||
115 | "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", | ||
116 | "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
117 | ] | ||
118 | |||
119 | [[package]] | ||
120 | name = "fuchsia-cprng" | ||
121 | version = "0.1.1" | ||
122 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
123 | |||
124 | [[package]] | ||
125 | name = "libc" | ||
126 | version = "0.2.50" | ||
127 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
128 | |||
129 | [[package]] | ||
130 | name = "log" | ||
131 | version = "0.4.6" | ||
132 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
133 | dependencies = [ | ||
134 | "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", | ||
135 | ] | ||
136 | |||
137 | [[package]] | ||
138 | name = "memchr" | ||
139 | version = "2.2.0" | ||
140 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
141 | |||
142 | [[package]] | ||
143 | name = "nix" | ||
144 | version = "0.11.0" | ||
145 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
146 | dependencies = [ | ||
147 | "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", | ||
148 | "cc 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", | ||
149 | "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", | ||
150 | "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", | ||
151 | "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||
152 | ] | ||
153 | |||
154 | [[package]] | ||
155 | name = "nodrop" | ||
156 | version = "0.1.13" | ||
157 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
158 | |||
159 | [[package]] | ||
160 | name = "proc-macro2" | ||
161 | version = "0.4.27" | ||
162 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
163 | dependencies = [ | ||
164 | "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
165 | ] | ||
166 | |||
167 | [[package]] | ||
168 | name = "quote" | ||
169 | version = "0.6.11" | ||
170 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
171 | dependencies = [ | ||
172 | "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", | ||
173 | ] | ||
174 | |||
175 | [[package]] | ||
176 | name = "rand_core" | ||
177 | version = "0.3.1" | ||
178 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
179 | dependencies = [ | ||
180 | "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
181 | ] | ||
182 | |||
183 | [[package]] | ||
184 | name = "rand_core" | ||
185 | version = "0.4.0" | ||
186 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
187 | |||
188 | [[package]] | ||
189 | name = "rand_os" | ||
190 | version = "0.1.3" | ||
191 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
192 | dependencies = [ | ||
193 | "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", | ||
194 | "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
195 | "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", | ||
196 | "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
197 | "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
198 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", | ||
199 | ] | ||
200 | |||
201 | [[package]] | ||
202 | name = "rdrand" | ||
203 | version = "0.4.0" | ||
204 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
205 | dependencies = [ | ||
206 | "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
207 | ] | ||
208 | |||
209 | [[package]] | ||
210 | name = "redox_syscall" | ||
211 | version = "0.1.51" | ||
212 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
213 | |||
214 | [[package]] | ||
215 | name = "redox_users" | ||
216 | version = "0.3.0" | ||
217 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
218 | dependencies = [ | ||
219 | "argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", | ||
220 | "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", | ||
221 | "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", | ||
222 | "redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)", | ||
223 | ] | ||
224 | |||
225 | [[package]] | ||
226 | name = "rustc-demangle" | ||
227 | version = "0.1.13" | ||
228 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
229 | |||
230 | [[package]] | ||
231 | name = "rustyline" | ||
232 | version = "3.0.0" | ||
233 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
234 | dependencies = [ | ||
235 | "dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", | ||
236 | "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", | ||
237 | "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", | ||
238 | "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
239 | "nix 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
240 | "unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
241 | "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", | ||
242 | "utf8parse 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
243 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", | ||
244 | ] | ||
245 | |||
246 | [[package]] | ||
247 | name = "scoped_threadpool" | ||
248 | version = "0.1.9" | ||
249 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
250 | |||
251 | [[package]] | ||
252 | name = "syn" | ||
253 | version = "0.15.29" | ||
254 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
255 | dependencies = [ | ||
256 | "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", | ||
257 | "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", | ||
258 | "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
259 | ] | ||
260 | |||
261 | [[package]] | ||
262 | name = "synstructure" | ||
263 | version = "0.10.1" | ||
264 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
265 | dependencies = [ | ||
266 | "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", | ||
267 | "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", | ||
268 | "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", | ||
269 | "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
270 | ] | ||
271 | |||
272 | [[package]] | ||
273 | name = "unicode-segmentation" | ||
274 | version = "1.2.1" | ||
275 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
276 | |||
277 | [[package]] | ||
278 | name = "unicode-width" | ||
279 | version = "0.1.5" | ||
280 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
281 | |||
282 | [[package]] | ||
283 | name = "unicode-xid" | ||
284 | version = "0.1.0" | ||
285 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
286 | |||
287 | [[package]] | ||
288 | name = "utf8parse" | ||
289 | version = "0.1.1" | ||
290 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
291 | |||
292 | [[package]] | ||
293 | name = "void" | ||
294 | version = "1.0.2" | ||
295 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
296 | |||
297 | [[package]] | ||
298 | name = "winapi" | ||
299 | version = "0.3.6" | ||
300 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
301 | dependencies = [ | ||
302 | "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
303 | "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
304 | ] | ||
305 | |||
306 | [[package]] | ||
307 | name = "winapi-i686-pc-windows-gnu" | ||
308 | version = "0.4.0" | ||
309 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
310 | |||
311 | [[package]] | ||
312 | name = "winapi-x86_64-pc-windows-gnu" | ||
313 | version = "0.4.0" | ||
314 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
315 | |||
316 | [metadata] | ||
317 | "checksum argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3f67b0b6a86dae6e67ff4ca2b6201396074996379fba2b92ff649126f37cb392" | ||
318 | "checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" | ||
319 | "checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799" | ||
320 | "checksum backtrace 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "cd5a90e2b463010cd0e0ce9a11d4a9d5d58d9f41d4a6ba3dcaf9e68b466e88b4" | ||
321 | "checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" | ||
322 | "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" | ||
323 | "checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" | ||
324 | "checksum cc 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)" = "c9ce8bb087aacff865633f0bd5aeaed910fe2fe55b55f4739527f2e023a2e53d" | ||
325 | "checksum cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "11d43355396e872eefb45ce6342e4374ed7bc2b3a502d1b28e36d6e23c05d1f4" | ||
326 | "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" | ||
327 | "checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e" | ||
328 | "checksum dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3fd78930633bd1c6e35c4b42b1df7b0cbc6bc191146e512bb3bedf243fcc3901" | ||
329 | "checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" | ||
330 | "checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" | ||
331 | "checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" | ||
332 | "checksum libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)" = "aab692d7759f5cd8c859e169db98ae5b52c924add2af5fbbca11d12fefb567c1" | ||
333 | "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" | ||
334 | "checksum memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2efc7bc57c883d4a4d6e3246905283d8dae951bb3bd32f49d6ef297f546e1c39" | ||
335 | "checksum nix 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d37e713a259ff641624b6cb20e3b12b2952313ba36b6823c0f16e6cfd9e5de17" | ||
336 | "checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" | ||
337 | "checksum proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)" = "4d317f9caece796be1980837fd5cb3dfec5613ebdb04ad0956deea83ce168915" | ||
338 | "checksum quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "cdd8e04bd9c52e0342b406469d494fcb033be4bdbe5c606016defbb1681411e1" | ||
339 | "checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" | ||
340 | "checksum rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d0e7a549d590831370895ab7ba4ea0c1b6b011d106b5ff2da6eee112615e6dc0" | ||
341 | "checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" | ||
342 | "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" | ||
343 | "checksum redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)" = "423e376fffca3dfa06c9e9790a9ccd282fafb3cc6e6397d01dbf64f9bacc6b85" | ||
344 | "checksum redox_users 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3fe5204c3a17e97dde73f285d49be585df59ed84b50a872baf416e73b62c3828" | ||
345 | "checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619" | ||
346 | "checksum rustyline 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "eb02ba7748691403057542ee60a1e7688fdfb46bd3bee752b8977537ee003ae2" | ||
347 | "checksum scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" | ||
348 | "checksum syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)" = "1825685f977249735d510a242a6727b46efe914bb67e38d30c071b1b72b1d5c2" | ||
349 | "checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" | ||
350 | "checksum unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aa6024fc12ddfd1c6dbc14a80fa2324d4568849869b779f6bd37e5e4c03344d1" | ||
351 | "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" | ||
352 | "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" | ||
353 | "checksum utf8parse 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8772a4ccbb4e89959023bc5b7cb8623a795caa7092d99f3aa9501b9484d4557d" | ||
354 | "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" | ||
355 | "checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" | ||
356 | "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" | ||
357 | "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" | ||
diff --git a/src/main.rs b/src/main.rs index 4e9a4e9..37b8d04 100644 --- a/src/main.rs +++ b/src/main.rs | |||
@@ -1,4 +1,5 @@ | |||
1 | use std::f64; | 1 | use std::f64; |
2 | use std::env; | ||
2 | 3 | ||
3 | mod lex; | 4 | mod lex; |
4 | use crate::lex::*; | 5 | use crate::lex::*; |
@@ -11,46 +12,60 @@ use crate::error::{ CalcError, handler }; | |||
11 | 12 | ||
12 | use rustyline::error::ReadlineError; | 13 | use rustyline::error::ReadlineError; |
13 | use rustyline::Editor; | 14 | use rustyline::Editor; |
14 | use rustyline::config::{ Config, Builder, ColorMode, EditMode }; | 15 | use rustyline::config::{ Builder, ColorMode, EditMode }; |
16 | |||
15 | 17 | ||
16 | fn main() { | 18 | fn main() { |
17 | let config_builder = Builder::new(); | 19 | let args: Vec<String> = env::args().collect(); |
18 | let config = config_builder.color_mode(ColorMode::Enabled) | 20 | if args.len() > 1 { |
19 | .edit_mode(EditMode::Emacs) | 21 | let mut expr = String::new(); |
20 | .history_ignore_space(true) | 22 | for arg in args[1..].iter() { |
21 | .max_history_size(1000) | 23 | expr.push_str(&arg[..]); |
22 | .build(); | 24 | } |
23 | let mut rl = Editor::<()>::with_config(config); | 25 | let evaled = eval_math_expression(&expr[..]); |
24 | if rl.load_history("history.txt").is_err() { | 26 | match evaled { |
25 | println!("No previous history."); | 27 | Ok(ans) => println!("{}", ans), |
26 | } | 28 | Err(e) => handler(e), |
29 | }; | ||
30 | } else { | ||
31 | let config_builder = Builder::new(); | ||
32 | let config = config_builder.color_mode(ColorMode::Enabled) | ||
33 | .edit_mode(EditMode::Emacs) | ||
34 | .history_ignore_space(true) | ||
35 | .max_history_size(1000) | ||
36 | .build(); | ||
37 | let mut rl = Editor::<()>::with_config(config); | ||
38 | if rl.load_history("history.txt").is_err() { | ||
39 | println!("No previous history."); | ||
40 | } | ||
27 | 41 | ||
28 | loop { | 42 | loop { |
29 | let readline = rl.readline("> "); | 43 | let readline = rl.readline("> "); |
30 | match readline { | 44 | match readline { |
31 | Ok(line) => { | 45 | Ok(line) => { |
32 | rl.add_history_entry(line.as_ref()); | 46 | rl.add_history_entry(line.as_ref()); |
33 | let evaled = eval_math_expression(&line[..]); | 47 | let evaled = eval_math_expression(&line[..]); |
34 | match evaled { | 48 | match evaled { |
35 | Ok(ans) => println!("{}", ans), | 49 | Ok(ans) => println!("{}", ans), |
36 | Err(e) => handler(e), | 50 | Err(e) => handler(e), |
37 | }; | 51 | }; |
38 | }, | 52 | }, |
39 | Err(ReadlineError::Interrupted) => { | 53 | Err(ReadlineError::Interrupted) => { |
40 | println!("CTRL-C"); | 54 | println!("CTRL-C"); |
41 | break | 55 | break |
42 | }, | 56 | }, |
43 | Err(ReadlineError::Eof) => { | 57 | Err(ReadlineError::Eof) => { |
44 | println!("CTRL-D"); | 58 | println!("CTRL-D"); |
45 | break | 59 | break |
46 | }, | 60 | }, |
47 | Err(err) => { | 61 | Err(err) => { |
48 | println!("Error: {:?}", err); | 62 | println!("Error: {:?}", err); |
49 | break | 63 | break |
64 | } | ||
50 | } | 65 | } |
51 | } | 66 | } |
67 | rl.save_history("history.txt").unwrap(); | ||
52 | } | 68 | } |
53 | rl.save_history("history.txt").unwrap(); | ||
54 | } | 69 | } |
55 | 70 | ||
56 | fn autobalance_parens(input: &str) -> Result<String, CalcError> { | 71 | fn autobalance_parens(input: &str) -> Result<String, CalcError> { |