Browse Source

Parse command line arguments, allow setting the config file

Johannes Hofmann 8 years ago
parent
commit
68bbe544e5
3 changed files with 104 additions and 4 deletions
  1. 80
    0
      Cargo.lock
  2. 1
    0
      Cargo.toml
  3. 23
    4
      src/main.rs

+ 80
- 0
Cargo.lock View File

8
 version = "0.2.3"
8
 version = "0.2.3"
9
 source = "registry+https://github.com/rust-lang/crates.io-index"
9
 source = "registry+https://github.com/rust-lang/crates.io-index"
10
 
10
 
11
+[[package]]
12
+name = "ansi_term"
13
+version = "0.10.2"
14
+source = "registry+https://github.com/rust-lang/crates.io-index"
15
+
16
+[[package]]
17
+name = "atty"
18
+version = "0.2.6"
19
+source = "registry+https://github.com/rust-lang/crates.io-index"
20
+dependencies = [
21
+ "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
22
+ "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
23
+ "winapi 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
24
+]
25
+
11
 [[package]]
26
 [[package]]
12
 name = "backtrace"
27
 name = "backtrace"
13
 version = "0.3.5"
28
 version = "0.3.5"
91
  "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
106
  "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
92
 ]
107
 ]
93
 
108
 
109
+[[package]]
110
+name = "clap"
111
+version = "2.29.1"
112
+source = "registry+https://github.com/rust-lang/crates.io-index"
113
+dependencies = [
114
+ "ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
115
+ "atty 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
116
+ "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
117
+ "strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
118
+ "textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
119
+ "unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
120
+ "vec_map 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
121
+]
122
+
94
 [[package]]
123
 [[package]]
95
 name = "coco"
124
 name = "coco"
96
 version = "0.1.1"
125
 version = "0.1.1"
183
 name = "deltamap"
212
 name = "deltamap"
184
 version = "0.1.0"
213
 version = "0.1.0"
185
 dependencies = [
214
 dependencies = [
215
+ "clap 2.29.1 (registry+https://github.com/rust-lang/crates.io-index)",
186
  "gl 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
216
  "gl 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
187
  "gl_generator 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
217
  "gl_generator 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
188
  "image 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)",
218
  "image 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)",
815
 version = "0.1.37"
845
 version = "0.1.37"
816
 source = "registry+https://github.com/rust-lang/crates.io-index"
846
 source = "registry+https://github.com/rust-lang/crates.io-index"
817
 
847
 
848
+[[package]]
849
+name = "redox_termios"
850
+version = "0.1.1"
851
+source = "registry+https://github.com/rust-lang/crates.io-index"
852
+dependencies = [
853
+ "redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
854
+]
855
+
818
 [[package]]
856
 [[package]]
819
 name = "relay"
857
 name = "relay"
820
 version = "0.1.0"
858
 version = "0.1.0"
991
 version = "0.2.1"
1029
 version = "0.2.1"
992
 source = "registry+https://github.com/rust-lang/crates.io-index"
1030
 source = "registry+https://github.com/rust-lang/crates.io-index"
993
 
1031
 
1032
+[[package]]
1033
+name = "strsim"
1034
+version = "0.6.0"
1035
+source = "registry+https://github.com/rust-lang/crates.io-index"
1036
+
994
 [[package]]
1037
 [[package]]
995
 name = "take"
1038
 name = "take"
996
 version = "0.1.0"
1039
 version = "0.1.0"
1004
  "rand 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)",
1047
  "rand 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)",
1005
 ]
1048
 ]
1006
 
1049
 
1050
+[[package]]
1051
+name = "termion"
1052
+version = "1.5.1"
1053
+source = "registry+https://github.com/rust-lang/crates.io-index"
1054
+dependencies = [
1055
+ "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
1056
+ "redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
1057
+ "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
1058
+]
1059
+
1060
+[[package]]
1061
+name = "textwrap"
1062
+version = "0.9.0"
1063
+source = "registry+https://github.com/rust-lang/crates.io-index"
1064
+dependencies = [
1065
+ "unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
1066
+]
1067
+
1007
 [[package]]
1068
 [[package]]
1008
 name = "time"
1069
 name = "time"
1009
 version = "0.1.39"
1070
 version = "0.1.39"
1112
 version = "0.1.5"
1173
 version = "0.1.5"
1113
 source = "registry+https://github.com/rust-lang/crates.io-index"
1174
 source = "registry+https://github.com/rust-lang/crates.io-index"
1114
 
1175
 
1176
+[[package]]
1177
+name = "unicode-width"
1178
+version = "0.1.4"
1179
+source = "registry+https://github.com/rust-lang/crates.io-index"
1180
+
1115
 [[package]]
1181
 [[package]]
1116
 name = "url"
1182
 name = "url"
1117
 version = "1.6.0"
1183
 version = "1.6.0"
1144
 version = "0.2.2"
1210
 version = "0.2.2"
1145
 source = "registry+https://github.com/rust-lang/crates.io-index"
1211
 source = "registry+https://github.com/rust-lang/crates.io-index"
1146
 
1212
 
1213
+[[package]]
1214
+name = "vec_map"
1215
+version = "0.8.0"
1216
+source = "registry+https://github.com/rust-lang/crates.io-index"
1217
+
1147
 [[package]]
1218
 [[package]]
1148
 name = "version_check"
1219
 name = "version_check"
1149
 version = "0.1.3"
1220
 version = "0.1.3"
1213
 [metadata]
1284
 [metadata]
1214
 "checksum adler32 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6cbd0b9af8587c72beadc9f72d35b9fbb070982c9e6203e46e93f10df25f8f45"
1285
 "checksum adler32 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6cbd0b9af8587c72beadc9f72d35b9fbb070982c9e6203e46e93f10df25f8f45"
1215
 "checksum android_glue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "000444226fcff248f2bc4c7625be32c63caccfecc2723a2b9f78a7487a49c407"
1286
 "checksum android_glue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "000444226fcff248f2bc4c7625be32c63caccfecc2723a2b9f78a7487a49c407"
1287
+"checksum ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6b3568b48b7cefa6b8ce125f9bb4989e52fbcc29ebea88df04cc7c5f12f70455"
1288
+"checksum atty 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "8352656fd42c30a0c3c89d26dea01e3b77c0ab2af18230835c15e2e13cd51859"
1216
 "checksum backtrace 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ebbbf59b1c43eefa8c3ede390fcc36820b4999f7914104015be25025e0d62af2"
1289
 "checksum backtrace 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ebbbf59b1c43eefa8c3ede390fcc36820b4999f7914104015be25025e0d62af2"
1217
 "checksum backtrace-sys 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "44585761d6161b0f57afc49482ab6bd067e4edef48c12a152c237eb0203f7661"
1290
 "checksum backtrace-sys 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "44585761d6161b0f57afc49482ab6bd067e4edef48c12a152c237eb0203f7661"
1218
 "checksum base64 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "229d032f1a99302697f10b27167ae6d03d49d032e6a8e2550e8d3fc13356d2b4"
1291
 "checksum base64 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "229d032f1a99302697f10b27167ae6d03d49d032e6a8e2550e8d3fc13356d2b4"
1225
 "checksum cc 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "deaf9ec656256bb25b404c51ef50097207b9cbb29c933d31f92cae5a8a0ffee0"
1298
 "checksum cc 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "deaf9ec656256bb25b404c51ef50097207b9cbb29c933d31f92cae5a8a0ffee0"
1226
 "checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de"
1299
 "checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de"
1227
 "checksum cgl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "86765cb42c2a2c497e142af72517c1b4d7ae5bb2f25dfa77a5c69642f2342d89"
1300
 "checksum cgl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "86765cb42c2a2c497e142af72517c1b4d7ae5bb2f25dfa77a5c69642f2342d89"
1301
+"checksum clap 2.29.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8f4a2b3bb7ef3c672d7c13d15613211d5a6976b6892c598b0fcb5d40765f19c2"
1228
 "checksum coco 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c06169f5beb7e31c7c67ebf5540b8b472d23e3eade3b2ec7d1f5b504a85f91bd"
1302
 "checksum coco 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c06169f5beb7e31c7c67ebf5540b8b472d23e3eade3b2ec7d1f5b504a85f91bd"
1229
 "checksum cocoa 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac0d785ff4faf0ff23d7b5561346bb50dc7ef9a11cb0e65e07ef776b7752938f"
1303
 "checksum cocoa 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac0d785ff4faf0ff23d7b5561346bb50dc7ef9a11cb0e65e07ef776b7752938f"
1230
 "checksum color_quant 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a475fc4af42d83d28adf72968d9bcfaf035a1a9381642d8e85d8a04957767b0d"
1304
 "checksum color_quant 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a475fc4af42d83d28adf72968d9bcfaf035a1a9381642d8e85d8a04957767b0d"
1307
 "checksum rayon 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ed02d09394c94ffbdfdc755ad62a132e94c3224a8354e78a1200ced34df12edf"
1381
 "checksum rayon 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ed02d09394c94ffbdfdc755ad62a132e94c3224a8354e78a1200ced34df12edf"
1308
 "checksum rayon-core 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e64b609139d83da75902f88fd6c01820046840a18471e4dfcd5ac7c0f46bea53"
1382
 "checksum rayon-core 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e64b609139d83da75902f88fd6c01820046840a18471e4dfcd5ac7c0f46bea53"
1309
 "checksum redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "0d92eecebad22b767915e4d529f89f28ee96dbbf5a4810d2b844373f136417fd"
1383
 "checksum redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "0d92eecebad22b767915e4d529f89f28ee96dbbf5a4810d2b844373f136417fd"
1384
+"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
1310
 "checksum relay 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f301bafeb60867c85170031bdb2fcf24c8041f33aee09e7b116a58d4e9f781c5"
1385
 "checksum relay 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f301bafeb60867c85170031bdb2fcf24c8041f33aee09e7b116a58d4e9f781c5"
1311
 "checksum reqwest 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3161ca63fd11ce36c7718af239e6492a25a3dbfcec54240f959b9d816cf42413"
1386
 "checksum reqwest 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3161ca63fd11ce36c7718af239e6492a25a3dbfcec54240f959b9d816cf42413"
1312
 "checksum rustc-demangle 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "aee45432acc62f7b9a108cc054142dac51f979e69e71ddce7d6fc7adf29e817e"
1387
 "checksum rustc-demangle 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "aee45432acc62f7b9a108cc054142dac51f979e69e71ddce7d6fc7adf29e817e"
1327
 "checksum slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17b4fcaed89ab08ef143da37bc52adbcc04d4a69014f4c1208d6b51f0c47bc23"
1402
 "checksum slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17b4fcaed89ab08ef143da37bc52adbcc04d4a69014f4c1208d6b51f0c47bc23"
1328
 "checksum slab 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fdeff4cd9ecff59ec7e3744cbca73dfe5ac35c2aedb2cfba8a1c715a18912e9d"
1403
 "checksum slab 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fdeff4cd9ecff59ec7e3744cbca73dfe5ac35c2aedb2cfba8a1c715a18912e9d"
1329
 "checksum smallvec 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4c8cbcd6df1e117c2210e13ab5109635ad68a929fcbb8964dc965b76cb5ee013"
1404
 "checksum smallvec 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4c8cbcd6df1e117c2210e13ab5109635ad68a929fcbb8964dc965b76cb5ee013"
1405
+"checksum strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d15c810519a91cf877e7e36e63fe068815c678181439f2f29e2562147c3694"
1330
 "checksum take 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b157868d8ac1f56b64604539990685fa7611d8fa9e5476cf0c02cf34d32917c5"
1406
 "checksum take 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b157868d8ac1f56b64604539990685fa7611d8fa9e5476cf0c02cf34d32917c5"
1331
 "checksum tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "87974a6f5c1dfb344d733055601650059a3363de2a6104819293baff662132d6"
1407
 "checksum tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "87974a6f5c1dfb344d733055601650059a3363de2a6104819293baff662132d6"
1408
+"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
1409
+"checksum textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c0b59b6b4b44d867f1370ef1bd91bfb262bf07bf0ae65c202ea2fbc16153b693"
1332
 "checksum time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "a15375f1df02096fb3317256ce2cee6a1f42fc84ea5ad5fc8c421cfe40c73098"
1410
 "checksum time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "a15375f1df02096fb3317256ce2cee6a1f42fc84ea5ad5fc8c421cfe40c73098"
1333
 "checksum tokio-core 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "52b4e32d8edbf29501aabb3570f027c6ceb00ccef6538f4bddba0200503e74e8"
1411
 "checksum tokio-core 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "52b4e32d8edbf29501aabb3570f027c6ceb00ccef6538f4bddba0200503e74e8"
1334
 "checksum tokio-io 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "514aae203178929dbf03318ad7c683126672d4d96eccb77b29603d33c9e25743"
1412
 "checksum tokio-io 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "514aae203178929dbf03318ad7c683126672d4d96eccb77b29603d33c9e25743"
1340
 "checksum unicase 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "284b6d3db520d67fbe88fd778c21510d1b0ba4a551e5d0fbb023d33405f6de8a"
1418
 "checksum unicase 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "284b6d3db520d67fbe88fd778c21510d1b0ba4a551e5d0fbb023d33405f6de8a"
1341
 "checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5"
1419
 "checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5"
1342
 "checksum unicode-normalization 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "51ccda9ef9efa3f7ef5d91e8f9b83bbe6955f9bf86aec89d5cce2c874625920f"
1420
 "checksum unicode-normalization 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "51ccda9ef9efa3f7ef5d91e8f9b83bbe6955f9bf86aec89d5cce2c874625920f"
1421
+"checksum unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f"
1343
 "checksum url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa35e768d4daf1d85733418a49fb42e10d7f633e394fccab4ab7aba897053fe2"
1422
 "checksum url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa35e768d4daf1d85733418a49fb42e10d7f633e394fccab4ab7aba897053fe2"
1344
 "checksum user32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ef4711d107b21b410a3a974b1204d9accc8b10dad75d8324b5d755de1617d47"
1423
 "checksum user32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ef4711d107b21b410a3a974b1204d9accc8b10dad75d8324b5d755de1617d47"
1345
 "checksum uuid 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bcc7e3b898aa6f6c08e5295b6c89258d1331e9ac578cc992fb818759951bdc22"
1424
 "checksum uuid 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bcc7e3b898aa6f6c08e5295b6c89258d1331e9ac578cc992fb818759951bdc22"
1346
 "checksum vcpkg 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9e0a7d8bed3178a8fb112199d466eeca9ed09a14ba8ad67718179b4fd5487d0b"
1425
 "checksum vcpkg 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9e0a7d8bed3178a8fb112199d466eeca9ed09a14ba8ad67718179b4fd5487d0b"
1426
+"checksum vec_map 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "887b5b631c2ad01628bbbaa7dd4c869f80d3186688f8d0b6f58774fbe324988c"
1347
 "checksum version_check 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6b772017e347561807c1aa192438c5fd74242a670a6cffacc40f2defd1dc069d"
1427
 "checksum version_check 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6b772017e347561807c1aa192438c5fd74242a670a6cffacc40f2defd1dc069d"
1348
 "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
1428
 "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
1349
 "checksum winapi 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b09fb3b6f248ea4cd42c9a65113a847d612e17505d6ebd1f7357ad68a8bf8693"
1429
 "checksum winapi 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b09fb3b6f248ea4cd42c9a65113a847d612e17505d6ebd1f7357ad68a8bf8693"

+ 1
- 0
Cargo.toml View File

4
 authors = ["Johannes Hofmann <mail@b-r-u.org>"]
4
 authors = ["Johannes Hofmann <mail@b-r-u.org>"]
5
 
5
 
6
 [dependencies]
6
 [dependencies]
7
+clap = "2.29"
7
 gl = "0.9"
8
 gl = "0.9"
8
 image = "0.18"
9
 image = "0.18"
9
 linked-hash-map = "0.5.0"
10
 linked-hash-map = "0.5.0"

+ 23
- 4
src/main.rs View File

1
+extern crate clap;
1
 extern crate glutin;
2
 extern crate glutin;
2
 extern crate image;
3
 extern crate image;
3
 extern crate linked_hash_map;
4
 extern crate linked_hash_map;
5
 extern crate toml;
6
 extern crate toml;
6
 extern crate xdg;
7
 extern crate xdg;
7
 
8
 
8
-
9
 #[macro_use]
9
 #[macro_use]
10
 mod context;
10
 mod context;
11
 
11
 
22
 mod tile_loader;
22
 mod tile_loader;
23
 mod tile_source;
23
 mod tile_source;
24
 
24
 
25
+use clap::Arg;
25
 use coord::ScreenCoord;
26
 use coord::ScreenCoord;
26
 use glutin::{ElementState, Event, MouseButton, MouseScrollDelta, VirtualKeyCode};
27
 use glutin::{ElementState, Event, MouseButton, MouseScrollDelta, VirtualKeyCode};
27
 use map_view_gl::MapViewGl;
28
 use map_view_gl::MapViewGl;
28
 use std::time::{Duration, Instant};
29
 use std::time::{Duration, Instant};
29
 use tile_source::TileSource;
30
 use tile_source::TileSource;
30
 
31
 
31
-#[cfg(target_os = "android")]
32
-android_start!(main);
32
+
33
+static VERSION: &'static str = "0.1.0";
34
+
33
 
35
 
34
 #[derive(Copy, Clone, Debug, PartialEq, Eq)]
36
 #[derive(Copy, Clone, Debug, PartialEq, Eq)]
35
 enum Action {
37
 enum Action {
155
 }
157
 }
156
 
158
 
157
 fn main() {
159
 fn main() {
158
-    let config = config::Config::load().unwrap();
160
+    let matches = clap::App::new("DeltaMap")
161
+        .version(VERSION)
162
+        .author("Johannes Hofmann <mail@b-r-u.org>")
163
+        .about("A map viewer")
164
+        .arg(Arg::with_name("config")
165
+            .short("c")
166
+            .long("config")
167
+            .value_name("FILE")
168
+            .help("Set a custom config file")
169
+            .takes_value(true))
170
+        .get_matches();
171
+
172
+    let config = if let Some(config_path) = matches.value_of_os("config") {
173
+            config::Config::from_toml_file(config_path).unwrap()
174
+        } else {
175
+            config::Config::load().unwrap()
176
+        };
177
+
159
     let mut sources = TileSources::new(config.tile_sources()).unwrap();
178
     let mut sources = TileSources::new(config.tile_sources()).unwrap();
160
 
179
 
161
     let mut window = glutin::WindowBuilder::new().build().unwrap();
180
     let mut window = glutin::WindowBuilder::new().build().unwrap();