mirror of
https://github.com/restic/restic.git
synced 2026-02-22 16:56:24 +00:00
Compare commits
3200 Commits
v0.1.0-doc
...
v0.9.4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd9b2295f1 | ||
|
|
a439cdeb05 | ||
|
|
827f6d7b24 | ||
|
|
77ab10d401 | ||
|
|
3b0ad2e368 | ||
|
|
2996c110f1 | ||
|
|
4609b5c24d | ||
|
|
830511460a | ||
|
|
0dc3648416 | ||
|
|
d71dba3788 | ||
|
|
e482633943 | ||
|
|
900621051a | ||
|
|
1f246c5309 | ||
|
|
e40805b002 | ||
|
|
d65bea1b2a | ||
|
|
3b68acf853 | ||
|
|
82a70643a2 | ||
|
|
0dd805421e | ||
|
|
16b82f4b1d | ||
|
|
7a6bfcd58c | ||
|
|
de54618852 | ||
|
|
98526b8dbe | ||
|
|
0083680d33 | ||
|
|
05222b7343 | ||
|
|
d4ff5b6bf4 | ||
|
|
cf0883e16c | ||
|
|
a35a24b8b4 | ||
|
|
df7f72cdde | ||
|
|
3edc723bf0 | ||
|
|
71891b340c | ||
|
|
6f5c3e57f6 | ||
|
|
56af0ce370 | ||
|
|
c9745cd47e | ||
|
|
2434ab2106 | ||
|
|
1688713400 | ||
|
|
00597284de | ||
|
|
6dc7cca597 | ||
|
|
d32c7c2aba | ||
|
|
09e9b74cbd | ||
|
|
d53595e43c | ||
|
|
0de19cc87f | ||
|
|
2c9ec07d0b | ||
|
|
a7971a3ece | ||
|
|
4ab0022da8 | ||
|
|
4b3c054257 | ||
|
|
7486bfea5b | ||
|
|
c8fc72364a | ||
|
|
987ef2f4a9 | ||
|
|
5b95bb7059 | ||
|
|
8471a359ee | ||
|
|
f9422ff4c7 | ||
|
|
c0572ca15f | ||
|
|
a630d69e0c | ||
|
|
20bcd281a3 | ||
|
|
c012fccd22 | ||
|
|
920727dd34 | ||
|
|
157d365894 | ||
|
|
bfa18ee8ec | ||
|
|
890eebf151 | ||
|
|
9310cd0cd6 | ||
|
|
9f7ce7ce5a | ||
|
|
0b600d6cef | ||
|
|
3ae2a79bdf | ||
|
|
f7c0893f76 | ||
|
|
c3de301fc8 | ||
|
|
944b446ac0 | ||
|
|
b096fc7abf | ||
|
|
d10754e2b4 | ||
|
|
7ac683c360 | ||
|
|
6caa9d38ac | ||
|
|
19fd0f101f | ||
|
|
8c91c51d1b | ||
|
|
7e28bf7e97 | ||
|
|
43d6e426c8 | ||
|
|
26fc60e7cb | ||
|
|
e5d7879622 | ||
|
|
d2ee58f2e9 | ||
|
|
3f25537a06 | ||
|
|
d203ae37f4 | ||
|
|
6eedd66c1a | ||
|
|
e4b39ae553 | ||
|
|
7cbcb6d318 | ||
|
|
c0fca3f50a | ||
|
|
4c2072d875 | ||
|
|
92ecca1808 | ||
|
|
7236635cc1 | ||
|
|
21a3486ebb | ||
|
|
bda8d7722e | ||
|
|
c2bcb764cd | ||
|
|
9e24154ec9 | ||
|
|
9f3ca97ee8 | ||
|
|
32d5ceba87 | ||
|
|
e010f3b884 | ||
|
|
941202c119 | ||
|
|
c021ad2334 | ||
|
|
2b3420820b | ||
|
|
da57302fca | ||
|
|
1869930d95 | ||
|
|
1213d8fef4 | ||
|
|
a432b42c81 | ||
|
|
7d0f2eaf24 | ||
|
|
41a4d67d93 | ||
|
|
afde60e433 | ||
|
|
d7baa67acb | ||
|
|
167397c18c | ||
|
|
be36c5f150 | ||
|
|
9484a14ab2 | ||
|
|
0f5fc8fb3d | ||
|
|
a5b40e9372 | ||
|
|
c5ec4efe91 | ||
|
|
e64a0e0454 | ||
|
|
8b5b031f90 | ||
|
|
4a2134bbc5 | ||
|
|
484844aa1a | ||
|
|
4ed10239ad | ||
|
|
c4896ed642 | ||
|
|
29aaec383c | ||
|
|
0cb241b7d3 | ||
|
|
de4750b8e0 | ||
|
|
7b91c40e21 | ||
|
|
cc9bf02da1 | ||
|
|
b7959c44d2 | ||
|
|
277cba4b32 | ||
|
|
ed651df19b | ||
|
|
641dc65e6e | ||
|
|
de9136b29f | ||
|
|
b36345fd84 | ||
|
|
03402c8a04 | ||
|
|
966e5a5575 | ||
|
|
5aa0deeff9 | ||
|
|
af4d822380 | ||
|
|
fd95b86894 | ||
|
|
5dbef3712e | ||
|
|
63647e93e4 | ||
|
|
9b8deb51ba | ||
|
|
2c4b0d975e | ||
|
|
8ceda538ef | ||
|
|
233596f4bc | ||
|
|
6712ee8f92 | ||
|
|
0916ff71bd | ||
|
|
5971650f77 | ||
|
|
19725954ee | ||
|
|
b1e1b71bab | ||
|
|
f1799de309 | ||
|
|
585a5e3416 | ||
|
|
b7eeeedc3f | ||
|
|
a20d4bc6b0 | ||
|
|
fb31d66951 | ||
|
|
33dfbf5c38 | ||
|
|
d1df3718b5 | ||
|
|
e2da0a416c | ||
|
|
0c0a8e3d2b | ||
|
|
0882aca3a8 | ||
|
|
cd41915e10 | ||
|
|
2effacd444 | ||
|
|
c6901ff908 | ||
|
|
2f774acce3 | ||
|
|
5f8658238c | ||
|
|
2bb1be4d4e | ||
|
|
40e0016403 | ||
|
|
541d232f1c | ||
|
|
6bc99ce451 | ||
|
|
e42d2d1da8 | ||
|
|
bd9022962e | ||
|
|
91f1b40206 | ||
|
|
d9b89eead0 | ||
|
|
5399297de6 | ||
|
|
96f7be5d9b | ||
|
|
0922367308 | ||
|
|
e2d9900d82 | ||
|
|
1140950d7b | ||
|
|
6d9c008900 | ||
|
|
b617444158 | ||
|
|
e588c42646 | ||
|
|
14bb2a9005 | ||
|
|
f04d347e7a | ||
|
|
746182c526 | ||
|
|
08beb7d84c | ||
|
|
9795b00f51 | ||
|
|
bfc1bc6ee6 | ||
|
|
e9cdcf131c | ||
|
|
35e9885e8b | ||
|
|
16885529f7 | ||
|
|
3c02eeb5a8 | ||
|
|
9e9bb62ad4 | ||
|
|
175e630717 | ||
|
|
44f38ad049 | ||
|
|
ca928aeae4 | ||
|
|
27b60a05b4 | ||
|
|
8af4b331ef | ||
|
|
a5a46e4989 | ||
|
|
e4cdb0eab3 | ||
|
|
e9a764129f | ||
|
|
65129bde5e | ||
|
|
b4beaf807b | ||
|
|
4734056583 | ||
|
|
71e0408390 | ||
|
|
1352a9d848 | ||
|
|
e0f68ec2c0 | ||
|
|
9c6e0c6eb9 | ||
|
|
4cbc7c4467 | ||
|
|
aaff8803ef | ||
|
|
16e20676b6 | ||
|
|
6cd5f8b7f5 | ||
|
|
10c0b8080e | ||
|
|
d31666d332 | ||
|
|
6d53e767d5 | ||
|
|
f1b0bb33dd | ||
|
|
99ae913414 | ||
|
|
df78896e59 | ||
|
|
c896751ce2 | ||
|
|
501189625e | ||
|
|
a065ada46a | ||
|
|
17d6d537e2 | ||
|
|
5cc224e44a | ||
|
|
896089976a | ||
|
|
a563f87818 | ||
|
|
de307ea2ab | ||
|
|
4bc904a527 | ||
|
|
5937b5b355 | ||
|
|
76387b6cd0 | ||
|
|
9aa36a37c7 | ||
|
|
9fd3796d93 | ||
|
|
93fa17b53f | ||
|
|
15ad0e5bc7 | ||
|
|
1f27d17c0d | ||
|
|
8af918a1e4 | ||
|
|
bb5425a1d8 | ||
|
|
12246969db | ||
|
|
9151eec24e | ||
|
|
22475729ce | ||
|
|
04c67d700d | ||
|
|
d708d607fa | ||
|
|
46f71f4c22 | ||
|
|
48cc2f2188 | ||
|
|
bd6e7c934c | ||
|
|
7925217e25 | ||
|
|
401a564486 | ||
|
|
31176d212b | ||
|
|
2d89311d49 | ||
|
|
5a25ad1972 | ||
|
|
79d3a18b31 | ||
|
|
89f17847ad | ||
|
|
1ab5703404 | ||
|
|
49d95e9a50 | ||
|
|
7dff1a08d0 | ||
|
|
5fee36fa84 | ||
|
|
b0211dff49 | ||
|
|
0f6d21cf84 | ||
|
|
10b5cf8f32 | ||
|
|
ad5aec3f3b | ||
|
|
6e1a3987b7 | ||
|
|
9630398e3b | ||
|
|
7e34de4c29 | ||
|
|
ace5cc4ed3 | ||
|
|
7f617cfd7f | ||
|
|
0deb4e5994 | ||
|
|
6b9dde3ce8 | ||
|
|
c145b618d4 | ||
|
|
b07bb3d8c3 | ||
|
|
9b513312e2 | ||
|
|
bf26a3ed57 | ||
|
|
77a8d931b8 | ||
|
|
11ce572894 | ||
|
|
7a468d1226 | ||
|
|
00e2fd8b5f | ||
|
|
0f83fea007 | ||
|
|
04f7c054cd | ||
|
|
5dd0df0162 | ||
|
|
abc923f693 | ||
|
|
ac3bd6b2eb | ||
|
|
156d85a29b | ||
|
|
8c146eac4b | ||
|
|
6f5b0f3622 | ||
|
|
beb208e159 | ||
|
|
c221d662d0 | ||
|
|
143597d445 | ||
|
|
16ca837763 | ||
|
|
ce7fb166b3 | ||
|
|
9de51d04ec | ||
|
|
dc39773cd2 | ||
|
|
30fa305c07 | ||
|
|
686f24b578 | ||
|
|
247d2b7215 | ||
|
|
017cd113d3 | ||
|
|
f744c2553e | ||
|
|
56cd6bd495 | ||
|
|
bff635bc5f | ||
|
|
3422c1ca83 | ||
|
|
f6b2731aa5 | ||
|
|
3eb5b45b41 | ||
|
|
01aacf41b5 | ||
|
|
2caf8edc55 | ||
|
|
3151978f58 | ||
|
|
ab4ef432ff | ||
|
|
be4f54b603 | ||
|
|
7260110c27 | ||
|
|
2437f11af7 | ||
|
|
57873502f8 | ||
|
|
3678ec9ad8 | ||
|
|
a717e9e6f7 | ||
|
|
12c797700e | ||
|
|
daca9d6815 | ||
|
|
930602a444 | ||
|
|
acb05e7855 | ||
|
|
a7b95d716a | ||
|
|
925b542eb0 | ||
|
|
f7659bd8b0 | ||
|
|
8c124a2b75 | ||
|
|
d3ad63a4ec | ||
|
|
271c50cf5c | ||
|
|
1aeb193fd9 | ||
|
|
f715bef82f | ||
|
|
4fc00d4120 | ||
|
|
7603ab7ac1 | ||
|
|
36fa1f8c20 | ||
|
|
445fb23b6d | ||
|
|
5f79b4cb6c | ||
|
|
8e15b59347 | ||
|
|
6e2e957332 | ||
|
|
7ffc03ff8f | ||
|
|
44924ba043 | ||
|
|
ce19f26948 | ||
|
|
74016d5981 | ||
|
|
57636a4573 | ||
|
|
4f6d2502f7 | ||
|
|
f1f69bc648 | ||
|
|
d7551d7b0c | ||
|
|
fb74de6360 | ||
|
|
67535e00a8 | ||
|
|
19592285eb | ||
|
|
f64862722a | ||
|
|
254239c2a9 | ||
|
|
cce1a1f768 | ||
|
|
754482fe6c | ||
|
|
73153dbd3f | ||
|
|
92421ec47f | ||
|
|
9acc9243ba | ||
|
|
df64998649 | ||
|
|
64d27eed86 | ||
|
|
abb18a830c | ||
|
|
1e42f4f300 | ||
|
|
bd742ddb69 | ||
|
|
b511f4dce2 | ||
|
|
7961740dcc | ||
|
|
dc3032c360 | ||
|
|
44fb2a860f | ||
|
|
fbf8073dfc | ||
|
|
7ddf91b65c | ||
|
|
8dae2de2ce | ||
|
|
03a0377410 | ||
|
|
025ec9dff5 | ||
|
|
2384c1cee7 | ||
|
|
bb2ad76833 | ||
|
|
30cfd13328 | ||
|
|
9ffc26883a | ||
|
|
83c51db903 | ||
|
|
d30d5d4473 | ||
|
|
5088905502 | ||
|
|
ae72b438b0 | ||
|
|
ddf2065ce2 | ||
|
|
228a970540 | ||
|
|
c7a8086c19 | ||
|
|
c2c06ae2c9 | ||
|
|
1824168aa3 | ||
|
|
350761f1ba | ||
|
|
3231945a85 | ||
|
|
f080142137 | ||
|
|
ff785924de | ||
|
|
393a7266c9 | ||
|
|
cb8d2d3df5 | ||
|
|
a884ce1566 | ||
|
|
5ae8316c24 | ||
|
|
85eca1b5e9 | ||
|
|
a1536f38fa | ||
|
|
888f52afd1 | ||
|
|
e206680947 | ||
|
|
5fa6dc53cb | ||
|
|
26be094f28 | ||
|
|
e4c0d77bdd | ||
|
|
1dd655dad2 | ||
|
|
581d0984fe | ||
|
|
e62add84bc | ||
|
|
63779c1eb4 | ||
|
|
c204382ea9 | ||
|
|
321efec60c | ||
|
|
33dbd0ba5c | ||
|
|
9a73869c27 | ||
|
|
8f26fe271c | ||
|
|
251335f124 | ||
|
|
081743d0a5 | ||
|
|
3a86f4852b | ||
|
|
14aead94b3 | ||
|
|
ce01ca30d6 | ||
|
|
e2d347a698 | ||
|
|
42ebb0a0a6 | ||
|
|
419acad3c3 | ||
|
|
810b5ea076 | ||
|
|
fc5439a37a | ||
|
|
48aab8bd65 | ||
|
|
6fbcd1694b | ||
|
|
494fe2a8b5 | ||
|
|
f761068f4e | ||
|
|
c44e808aa5 | ||
|
|
ab37c6095a | ||
|
|
d6fd94e49d | ||
|
|
53040a2e34 | ||
|
|
cfc19b4582 | ||
|
|
141fabdd09 | ||
|
|
d49ca42771 | ||
|
|
f6fded729d | ||
|
|
465700595c | ||
|
|
0fcd9d6926 | ||
|
|
dd3b9910ee | ||
|
|
185b60c22b | ||
|
|
589c23dc23 | ||
|
|
0183fea926 | ||
|
|
7d9642523b | ||
|
|
4bf07a74a0 | ||
|
|
2a976d795f | ||
|
|
1892b314f8 | ||
|
|
b7bed406b9 | ||
|
|
ee4202f7c3 | ||
|
|
4cd28713b6 | ||
|
|
e3fe87f269 | ||
|
|
a02698fcdd | ||
|
|
bfd923e81e | ||
|
|
20bfed5985 | ||
|
|
e40191942d | ||
|
|
abd34ab76f | ||
|
|
4b43a269ee | ||
|
|
e2b7dc6528 | ||
|
|
d2431b667f | ||
|
|
b70fdf61c4 | ||
|
|
e6f25c4811 | ||
|
|
adb682bc43 | ||
|
|
1e9744c9a4 | ||
|
|
9a02f17cc2 | ||
|
|
c284712cae | ||
|
|
2dbdf381b2 | ||
|
|
a1a49ce211 | ||
|
|
3252e4200c | ||
|
|
8d9d218d1c | ||
|
|
0785fbd418 | ||
|
|
b358dd369b | ||
|
|
d67b9a32c6 | ||
|
|
ecfe59235e | ||
|
|
a868a30f4d | ||
|
|
347a645450 | ||
|
|
9f5565b0fc | ||
|
|
fd979ab4c5 | ||
|
|
375868edcf | ||
|
|
060d8b57e0 | ||
|
|
cc627e832b | ||
|
|
5a0f0e3faa | ||
|
|
b52f2aa9a4 | ||
|
|
60ea2435be | ||
|
|
159badf5ba | ||
|
|
903a3a31dc | ||
|
|
548227e6df | ||
|
|
cd03275005 | ||
|
|
e43c9202a6 | ||
|
|
c5e75d1c98 | ||
|
|
526956af35 | ||
|
|
256104111d | ||
|
|
21c83b1725 | ||
|
|
581c62ee72 | ||
|
|
ef7747313d | ||
|
|
18d4ac2fd9 | ||
|
|
9180e2c48a | ||
|
|
a63989afcd | ||
|
|
d3c0bd6d0e | ||
|
|
fcfa6f0355 | ||
|
|
580f90d745 | ||
|
|
c7b624ba0d | ||
|
|
ca4af43c03 | ||
|
|
1f2463f42e | ||
|
|
157c854d04 | ||
|
|
ffc276a603 | ||
|
|
e42b7db008 | ||
|
|
024148cac9 | ||
|
|
8943741a0b | ||
|
|
95c5517c35 | ||
|
|
06179a7e81 | ||
|
|
cf1fb50f9c | ||
|
|
6793300850 | ||
|
|
2cbdfbf652 | ||
|
|
b2208bb9c2 | ||
|
|
4c25495d68 | ||
|
|
abdd59ea1b | ||
|
|
05ca903d48 | ||
|
|
fd77646f8b | ||
|
|
2a67258867 | ||
|
|
fca4fe4459 | ||
|
|
26757ae2e5 | ||
|
|
9d6890a236 | ||
|
|
2218ecd049 | ||
|
|
d0974c155d | ||
|
|
8026e6fdfb | ||
|
|
01f9662614 | ||
|
|
f928aeec34 | ||
|
|
f77bc0fae8 | ||
|
|
eb6650b201 | ||
|
|
bc68d55e94 | ||
|
|
ecbbd851a1 | ||
|
|
336719b058 | ||
|
|
e9f1721678 | ||
|
|
64d98945a6 | ||
|
|
84f82dae1a | ||
|
|
6bfd9f833b | ||
|
|
bb1a22d1e6 | ||
|
|
438719f269 | ||
|
|
c83c03ed63 | ||
|
|
19b9c881ca | ||
|
|
4e34325035 | ||
|
|
78bd591c7c | ||
|
|
39ac12f6ea | ||
|
|
400730afca | ||
|
|
d80e108b03 | ||
|
|
846c2b6869 | ||
|
|
d8bbe5dc84 | ||
|
|
d926b9fd80 | ||
|
|
4ba8d40282 | ||
|
|
4fb1401266 | ||
|
|
6d4c40f8d0 | ||
|
|
56e394ac33 | ||
|
|
c3cc5d7cee | ||
|
|
6b12b92339 | ||
|
|
16c314ab7f | ||
|
|
1449d7dc29 | ||
|
|
0e78ac92d8 | ||
|
|
c703d21d55 | ||
|
|
1af96fc6dd | ||
|
|
9fac2ca832 | ||
|
|
a5c0cf2324 | ||
|
|
38926d8576 | ||
|
|
f279731168 | ||
|
|
76b616451f | ||
|
|
fd12a3af20 | ||
|
|
3cd92efdcf | ||
|
|
b804279fe8 | ||
|
|
a56b8fad87 | ||
|
|
4c00efd4bf | ||
|
|
b6f98bdb02 | ||
|
|
c4b2486b7c | ||
|
|
83ca08245b | ||
|
|
a069467e72 | ||
|
|
6a7c23d2ae | ||
|
|
cc847a3d6d | ||
|
|
baebf45e2e | ||
|
|
fa4f438bc1 | ||
|
|
4e0b2a8e3a | ||
|
|
0532f08048 | ||
|
|
a472868e06 | ||
|
|
e4fdc5eb76 | ||
|
|
09365cc4ea | ||
|
|
2aa6b49651 | ||
|
|
7877797c7e | ||
|
|
1a26355dbe | ||
|
|
c5829e9ffc | ||
|
|
b5b246edd5 | ||
|
|
ee5e14d536 | ||
|
|
09bd924710 | ||
|
|
a9c2e84ccd | ||
|
|
a144b81c4a | ||
|
|
3c453a4217 | ||
|
|
1e2f23d77a | ||
|
|
2c76e724ab | ||
|
|
577faa7570 | ||
|
|
6a34e0d10f | ||
|
|
b08f21cdc6 | ||
|
|
1c1fede399 | ||
|
|
63a0913e6e | ||
|
|
325957443e | ||
|
|
4b2d3b15a2 | ||
|
|
4e2a87c920 | ||
|
|
901e1b129c | ||
|
|
4478d633e2 | ||
|
|
92f516b1d4 | ||
|
|
03193e6d92 | ||
|
|
01fe719aff | ||
|
|
2c964df3e2 | ||
|
|
8919125b0b | ||
|
|
1f5137aa70 | ||
|
|
a95eb33616 | ||
|
|
e68a7fea8a | ||
|
|
2e7ec717c1 | ||
|
|
22d5061df2 | ||
|
|
4544a77172 | ||
|
|
b3a073e066 | ||
|
|
b077a1227b | ||
|
|
3f48e0e0f4 | ||
|
|
86f4b03730 | ||
|
|
c43c94776b | ||
|
|
0b776e63e7 | ||
|
|
360ff1806a | ||
|
|
1beeb7d0dd | ||
|
|
e978b36713 | ||
|
|
737d93860a | ||
|
|
011217e4bf | ||
|
|
362d5afec4 | ||
|
|
4172fcd167 | ||
|
|
518bf4e5f6 | ||
|
|
17312d3a98 | ||
|
|
4d5c7a8749 | ||
|
|
fc0295016a | ||
|
|
99b62c11b8 | ||
|
|
6d9a029e09 | ||
|
|
20352886f3 | ||
|
|
3622b60c13 | ||
|
|
065fe1e54f | ||
|
|
4dc0f24b38 | ||
|
|
fe99340e40 | ||
|
|
e377759c81 | ||
|
|
61f6db25f4 | ||
|
|
cabbbd2b14 | ||
|
|
cf4cf94418 | ||
|
|
34f27edc03 | ||
|
|
345b6c4694 | ||
|
|
e4a39e02d2 | ||
|
|
432e167255 | ||
|
|
594256bfa4 | ||
|
|
0fcb1e6b7a | ||
|
|
38795c66c9 | ||
|
|
c0960f538f | ||
|
|
5b6568875c | ||
|
|
d8dd79eb0b | ||
|
|
2bdeb645b9 | ||
|
|
9f2ffa3e50 | ||
|
|
d4bab5c133 | ||
|
|
3473d73d0c | ||
|
|
917cc542c9 | ||
|
|
a9cf5d482a | ||
|
|
75946e7c58 | ||
|
|
19035e977b | ||
|
|
d9ba9279e0 | ||
|
|
31e156c666 | ||
|
|
7e6fff324c | ||
|
|
e94d2da890 | ||
|
|
874b3dbbd9 | ||
|
|
0d01c27c9e | ||
|
|
30110fcfc2 | ||
|
|
673f0bbd6c | ||
|
|
5a77b2ab49 | ||
|
|
a951e7b126 | ||
|
|
d3f9c8b362 | ||
|
|
a4ff591165 | ||
|
|
49dd70c771 | ||
|
|
a64f24029b | ||
|
|
0886738d24 | ||
|
|
9fc38803e0 | ||
|
|
e5c929b793 | ||
|
|
0e0fee9c8f | ||
|
|
26769a39eb | ||
|
|
923be90906 | ||
|
|
84a22eac92 | ||
|
|
6eb1be0be4 | ||
|
|
f31bbcf1a9 | ||
|
|
5d09fca6a2 | ||
|
|
34671d7c9b | ||
|
|
4a524da736 | ||
|
|
e361cc3807 | ||
|
|
3cd8a7bc96 | ||
|
|
8206f85d2e | ||
|
|
7022144e0f | ||
|
|
1bee3e01fa | ||
|
|
624a2d8305 | ||
|
|
57c6233982 | ||
|
|
c161aba084 | ||
|
|
0279fd7212 | ||
|
|
dedf17f5e8 | ||
|
|
817890794d | ||
|
|
b9ada91054 | ||
|
|
dfb6d0fced | ||
|
|
c6c1dccc53 | ||
|
|
279566bafe | ||
|
|
c67a8452f7 | ||
|
|
5253ef218c | ||
|
|
0923976909 | ||
|
|
492baf991f | ||
|
|
0dfdc11ed9 | ||
|
|
54c6837ec4 | ||
|
|
e085713b35 | ||
|
|
e77d8c64a7 | ||
|
|
a410fa16a1 | ||
|
|
b3e1089cf9 | ||
|
|
7f8e269891 | ||
|
|
fcc9ce81ba | ||
|
|
b9d643358a | ||
|
|
ab5ef600a2 | ||
|
|
04c4033695 | ||
|
|
de37b68baa | ||
|
|
bdc206d440 | ||
|
|
efe2e792b3 | ||
|
|
6f3c23eba7 | ||
|
|
4b34bc3210 | ||
|
|
6ed9100aa1 | ||
|
|
c63b02d0f1 | ||
|
|
d0205ec889 | ||
|
|
d8dcbc89d1 | ||
|
|
be0a5b7f06 | ||
|
|
24ce08e122 | ||
|
|
864eaeab7c | ||
|
|
96311d1a2b | ||
|
|
da77f4a2e2 | ||
|
|
6bb1bcce03 | ||
|
|
6edf28d1e1 | ||
|
|
929afc63d5 | ||
|
|
99f7fd74e3 | ||
|
|
58306bfabb | ||
|
|
f6890210aa | ||
|
|
5873ab4031 | ||
|
|
ab7a3a803d | ||
|
|
1e868933c5 | ||
|
|
21f67a0a13 | ||
|
|
272ccec7e1 | ||
|
|
68bf1509bd | ||
|
|
cfccd67600 | ||
|
|
bc461d32e0 | ||
|
|
ee4bfdf954 | ||
|
|
3037894f62 | ||
|
|
89075bdf6d | ||
|
|
c323f73bf9 | ||
|
|
aef5e03731 | ||
|
|
fc1f74d32d | ||
|
|
7d59df1ab8 | ||
|
|
2866f3f31c | ||
|
|
dc1154c8ad | ||
|
|
35a816e8ab | ||
|
|
93210614f4 | ||
|
|
dfd37afee2 | ||
|
|
08a5281bd4 | ||
|
|
cdb48a8970 | ||
|
|
4fd5f0b8a9 | ||
|
|
92ad6bf74f | ||
|
|
2c7dd3edf4 | ||
|
|
19e7803ac6 | ||
|
|
9f0605766c | ||
|
|
1a5d7a9965 | ||
|
|
296769355d | ||
|
|
07d080830e | ||
|
|
c99eabfb37 | ||
|
|
842fe43590 | ||
|
|
be02008025 | ||
|
|
29da86b473 | ||
|
|
bad7215696 | ||
|
|
881ff5e554 | ||
|
|
86b7fd0335 | ||
|
|
70209d7d1d | ||
|
|
f07552161c | ||
|
|
856f3a9135 | ||
|
|
49e9bcadb7 | ||
|
|
1b8823ef2e | ||
|
|
b5062959c8 | ||
|
|
2fb4d44a4d | ||
|
|
3c08f956a3 | ||
|
|
1463a7aaaa | ||
|
|
76b8e080c3 | ||
|
|
a9f9243afc | ||
|
|
34bf9de339 | ||
|
|
597f6be4e4 | ||
|
|
aeeec0ff94 | ||
|
|
ab040d8811 | ||
|
|
d58ae43317 | ||
|
|
b723094739 | ||
|
|
84dcc3c396 | ||
|
|
21747bc219 | ||
|
|
28b00891d2 | ||
|
|
b4e00c324f | ||
|
|
4eb9df63cf | ||
|
|
fde674d214 | ||
|
|
fbb08c14de | ||
|
|
8b95b48bae | ||
|
|
71a4ccea71 | ||
|
|
5a9c7c51e6 | ||
|
|
5abd133e26 | ||
|
|
2debb5c0e0 | ||
|
|
54c0794cf3 | ||
|
|
cff3f3dc0d | ||
|
|
c5575c7ed9 | ||
|
|
99d88ad297 | ||
|
|
7f0d964a05 | ||
|
|
514f1b8917 | ||
|
|
a7a99be460 | ||
|
|
e17f65b23a | ||
|
|
e86fb5eedd | ||
|
|
c8cb9a9509 | ||
|
|
aa333f4d49 | ||
|
|
c40002246d | ||
|
|
77a6054d64 | ||
|
|
94ec55ff2c | ||
|
|
2369da158f | ||
|
|
5379950c64 | ||
|
|
cbfa516575 | ||
|
|
fb62da1748 | ||
|
|
b1b1f6e04f | ||
|
|
05f826a4fc | ||
|
|
649afb1198 | ||
|
|
5dc8d3588d | ||
|
|
9d2aa0a71c | ||
|
|
c34db983d8 | ||
|
|
e805b968b1 | ||
|
|
e706f1a8d1 | ||
|
|
4219bfbcc9 | ||
|
|
f99c95c766 | ||
|
|
cccb2fc7e7 | ||
|
|
ff3de66ddf | ||
|
|
fb0d01ef1f | ||
|
|
e11a183578 | ||
|
|
ee6732d2c6 | ||
|
|
4b2f2b542d | ||
|
|
6eb2d76435 | ||
|
|
f63c7048c7 | ||
|
|
ca3c566a99 | ||
|
|
7719cf88d9 | ||
|
|
00e905ebe6 | ||
|
|
164acceb55 | ||
|
|
909d9273cc | ||
|
|
d62a664bb7 | ||
|
|
663c57ab4d | ||
|
|
ed99f53786 | ||
|
|
abc4027083 | ||
|
|
d6212ee2d9 | ||
|
|
9c55e8d69c | ||
|
|
1c9fca6d14 | ||
|
|
be205563be | ||
|
|
fc6c341b26 | ||
|
|
f86c141b83 | ||
|
|
a6d4888d48 | ||
|
|
44550a88a0 | ||
|
|
b5c23695c9 | ||
|
|
0084e42cb6 | ||
|
|
fe33c05a20 | ||
|
|
3789e55e20 | ||
|
|
4cec7e236a | ||
|
|
3a16148447 | ||
|
|
df2c03a6a4 | ||
|
|
ebce4b2581 | ||
|
|
953f3d55ee | ||
|
|
7e6bfdae79 | ||
|
|
0f4cbea27d | ||
|
|
59782e347c | ||
|
|
e835abeceb | ||
|
|
8e812b7ac0 | ||
|
|
685ce719ad | ||
|
|
2b39f9f4b2 | ||
|
|
b63de7c798 | ||
|
|
b0c6e53241 | ||
|
|
e9ea268847 | ||
|
|
dd91b13ff3 | ||
|
|
c4e9d5d11e | ||
|
|
52230b8f07 | ||
|
|
a3d43a92b3 | ||
|
|
2130897ce0 | ||
|
|
67da240068 | ||
|
|
1046eabf95 | ||
|
|
663e8284b2 | ||
|
|
5a43ca1ccb | ||
|
|
200415e0a1 | ||
|
|
ea50687e8b | ||
|
|
7335a2492f | ||
|
|
bcb6881ffb | ||
|
|
37df829b3d | ||
|
|
39f1ba1897 | ||
|
|
231076fa4a | ||
|
|
0bdb131521 | ||
|
|
c31a5e7e5c | ||
|
|
05958caf6e | ||
|
|
87e31799f2 | ||
|
|
35528506a6 | ||
|
|
2544978aaf | ||
|
|
97565d68a2 | ||
|
|
f49f5c5903 | ||
|
|
d89f2e5226 | ||
|
|
02f4f5dc66 | ||
|
|
5723636b35 | ||
|
|
5632ca4f44 | ||
|
|
539599d1f1 | ||
|
|
d77a326bb0 | ||
|
|
60a7a9d019 | ||
|
|
99f0fce673 | ||
|
|
b708cfee3f | ||
|
|
b8620429e2 | ||
|
|
aab414b368 | ||
|
|
e120b17abd | ||
|
|
5f43e17918 | ||
|
|
489eef5a6f | ||
|
|
8c550ca011 | ||
|
|
032621289b | ||
|
|
92316a9853 | ||
|
|
180741609e | ||
|
|
70250762f3 | ||
|
|
39ba17a2d6 | ||
|
|
cfe8c8c9cd | ||
|
|
b45fc89512 | ||
|
|
aabc0ccaa7 | ||
|
|
2bc4d200d4 | ||
|
|
0247fe01c0 | ||
|
|
c912b38bf0 | ||
|
|
559946c58a | ||
|
|
a99637c613 | ||
|
|
36501dda73 | ||
|
|
18ecd9df30 | ||
|
|
c686dd0448 | ||
|
|
6d91d468e7 | ||
|
|
5f9b5b0219 | ||
|
|
3f7d85360a | ||
|
|
8d8456590c | ||
|
|
85f9f3e290 | ||
|
|
9e1180a29b | ||
|
|
e17c1096a0 | ||
|
|
546d6f36b2 | ||
|
|
6ecd14d780 | ||
|
|
f6ed7dc013 | ||
|
|
e290f2591e | ||
|
|
75f90ca303 | ||
|
|
ca1430184f | ||
|
|
a297ab9d7c | ||
|
|
f078525d98 | ||
|
|
e03cc81a9a | ||
|
|
af27f1dde5 | ||
|
|
32505c3916 | ||
|
|
9a8d5a1bff | ||
|
|
740ee787c1 | ||
|
|
2eba0bfeec | ||
|
|
d780ec4bce | ||
|
|
6b564d21b3 | ||
|
|
6c2b2a58ad | ||
|
|
b80b68dcb3 | ||
|
|
29c92ca415 | ||
|
|
bc04ce8e6b | ||
|
|
6b6b75fa4a | ||
|
|
84e493beba | ||
|
|
323376efa2 | ||
|
|
e353b00501 | ||
|
|
2510d770ab | ||
|
|
7d8765a937 | ||
|
|
81a04656c5 | ||
|
|
2f26fb8834 | ||
|
|
d3ebe1311f | ||
|
|
42a8c19aae | ||
|
|
27ccea6371 | ||
|
|
4f46b4f393 | ||
|
|
221e741537 | ||
|
|
8b3b7bc5ef | ||
|
|
934ae1b559 | ||
|
|
0e7e3cb714 | ||
|
|
95b6e4e9e9 | ||
|
|
3a5e040b7e | ||
|
|
28c826868b | ||
|
|
1695c8ed55 | ||
|
|
366622f09a | ||
|
|
0dc31c03e1 | ||
|
|
0405e67f8b | ||
|
|
df350e1f6e | ||
|
|
06cb3f7058 | ||
|
|
56b884be17 | ||
|
|
a25d280f3e | ||
|
|
2253a73837 | ||
|
|
946c8399e2 | ||
|
|
9d0f13c4c0 | ||
|
|
eb9e2bc79a | ||
|
|
0722c44ba1 | ||
|
|
2424012d75 | ||
|
|
82ded35706 | ||
|
|
69fcb604c8 | ||
|
|
88607fc625 | ||
|
|
7092af6329 | ||
|
|
23d7d91597 | ||
|
|
ad82781743 | ||
|
|
20d78ab0d9 | ||
|
|
be24237063 | ||
|
|
d886cb5c27 | ||
|
|
63bb1933e5 | ||
|
|
81e6a9d0d0 | ||
|
|
5d4110d2a7 | ||
|
|
0cedb3ac9f | ||
|
|
0b44c629f2 | ||
|
|
2579fe6b7b | ||
|
|
812ce4bfc4 | ||
|
|
410efe0694 | ||
|
|
b2d944d5cb | ||
|
|
b846c3915c | ||
|
|
ffbc68aa2e | ||
|
|
eddb8549ef | ||
|
|
bb44855078 | ||
|
|
2567026ccb | ||
|
|
0cc8fc6f18 | ||
|
|
cc81b916a6 | ||
|
|
27fadd2c6e | ||
|
|
dc38265b54 | ||
|
|
1ea518d5ef | ||
|
|
901cd5edef | ||
|
|
e1fd47765b | ||
|
|
c02923fbfc | ||
|
|
7c5ce83044 | ||
|
|
37e2e9a844 | ||
|
|
26e5db1849 | ||
|
|
a2766ffe0c | ||
|
|
0f5e38609f | ||
|
|
f178cbf93d | ||
|
|
c8096ca8d2 | ||
|
|
27d29b9853 | ||
|
|
8a171731ba | ||
|
|
abde9e2fba | ||
|
|
6a4a328bbc | ||
|
|
8253fadc96 | ||
|
|
134abbd82b | ||
|
|
fe557b022a | ||
|
|
cd8226130a | ||
|
|
1ebf0e8de8 | ||
|
|
37ea764000 | ||
|
|
0fdb9a6129 | ||
|
|
47b326b7b5 | ||
|
|
e2cf6eb434 | ||
|
|
f79698dcdd | ||
|
|
35a5307db3 | ||
|
|
6341c7d72c | ||
|
|
f4bab789b8 | ||
|
|
fa893ee477 | ||
|
|
014cec06f1 | ||
|
|
431ab5aa6a | ||
|
|
262b0cd9d4 | ||
|
|
e83ec17e95 | ||
|
|
ea593fca1b | ||
|
|
fe1f151ae1 | ||
|
|
b12bba4e2a | ||
|
|
e2005e02bb | ||
|
|
41c8c946ba | ||
|
|
fe08686558 | ||
|
|
0ed2401711 | ||
|
|
06bd606d85 | ||
|
|
c347431907 | ||
|
|
f63d7048f9 | ||
|
|
f39f7c76dd | ||
|
|
0268d0e7d6 | ||
|
|
8515d093e0 | ||
|
|
fe3f326d8d | ||
|
|
8170db40c7 | ||
|
|
99ac0da4bc | ||
|
|
7e2c93420f | ||
|
|
6d46824fb0 | ||
|
|
bb435b39d9 | ||
|
|
2a67d7a6c2 | ||
|
|
ba43c8bab5 | ||
|
|
931e6ed2ac | ||
|
|
a5f0e9ab65 | ||
|
|
6fc133ad6a | ||
|
|
e1b80859f2 | ||
|
|
d069ee31b2 | ||
|
|
981752ade0 | ||
|
|
d01d07fc0a | ||
|
|
526aaca6f5 | ||
|
|
2f8147af59 | ||
|
|
f3016a9096 | ||
|
|
f854a41ba9 | ||
|
|
ca3cadef5e | ||
|
|
3304b0fcf0 | ||
|
|
d8938e259a | ||
|
|
53a554c89d | ||
|
|
e71db01230 | ||
|
|
178e946fc7 | ||
|
|
f3bff12939 | ||
|
|
7a99418dc5 | ||
|
|
c71ba466ea | ||
|
|
8ce5d35543 | ||
|
|
134f834c60 | ||
|
|
8a37c07295 | ||
|
|
bd0ada7842 | ||
|
|
eea96f652d | ||
|
|
38c3061df7 | ||
|
|
f5fa602482 | ||
|
|
e44ac55f63 | ||
|
|
f1cfb73a8b | ||
|
|
5b96885c6d | ||
|
|
c5da90a5b7 | ||
|
|
bcdebfb84e | ||
|
|
359b273649 | ||
|
|
2e2c8dc620 | ||
|
|
8d37b723ca | ||
|
|
315b7f282f | ||
|
|
a3f8e9dfa7 | ||
|
|
982810f7cc | ||
|
|
90b96d19cd | ||
|
|
6a52bb6f54 | ||
|
|
cacaa4393f | ||
|
|
d63ab4e9a4 | ||
|
|
ca6daec8dd | ||
|
|
c87f2420a6 | ||
|
|
f5bbbc52f4 | ||
|
|
9e3dde8ec7 | ||
|
|
9dba182e51 | ||
|
|
944fc857eb | ||
|
|
7507a658ac | ||
|
|
9fa4f5eb6b | ||
|
|
ce4d71d626 | ||
|
|
8e2ef3f38b | ||
|
|
8dc952775e | ||
|
|
99b6163e27 | ||
|
|
beaf55f1fc | ||
|
|
980bb9059f | ||
|
|
0e7281eb71 | ||
|
|
0b6133d7b5 | ||
|
|
b57ca64275 | ||
|
|
faadbd734b | ||
|
|
88b0a93409 | ||
|
|
4a995105a9 | ||
|
|
7fe496f983 | ||
|
|
e56370eb5b | ||
|
|
b8af7f63a0 | ||
|
|
3eea555155 | ||
|
|
897c923cc9 | ||
|
|
67193e3deb | ||
|
|
0e722efb09 | ||
|
|
3736f33ebf | ||
|
|
d1d9c3f9d7 | ||
|
|
cd5cbe0910 | ||
|
|
814e992c0b | ||
|
|
660fe78735 | ||
|
|
87d084e18c | ||
|
|
9ce2a73fc5 | ||
|
|
f2314b26ba | ||
|
|
74dcf41f25 | ||
|
|
b6ba30186f | ||
|
|
32637a0328 | ||
|
|
0addd90e14 | ||
|
|
1b5ee5b10a | ||
|
|
042adeb5d0 | ||
|
|
7e4ce0dacc | ||
|
|
8ceb22fe8a | ||
|
|
c5553ec855 | ||
|
|
bb3ed54291 | ||
|
|
513ba3b6f7 | ||
|
|
17d688afef | ||
|
|
d81eee26b3 | ||
|
|
cc5ada63a4 | ||
|
|
88fb60e0b5 | ||
|
|
02200acad0 | ||
|
|
1a2d190bdb | ||
|
|
2db4ff168a | ||
|
|
a77c8cc5d2 | ||
|
|
b8866c1fe4 | ||
|
|
f0f17db847 | ||
|
|
a5c003acb0 | ||
|
|
7b44fd0f9d | ||
|
|
cebee0b8fa | ||
|
|
d886bc6c48 | ||
|
|
d81adcfaa5 | ||
|
|
6da9bfbbce | ||
|
|
69a6e622d0 | ||
|
|
1dcfd64028 | ||
|
|
5d1c1f721e | ||
|
|
fbc8bbf305 | ||
|
|
cdef55bb88 | ||
|
|
26df48b2aa | ||
|
|
a7baea0522 | ||
|
|
55e6003749 | ||
|
|
846acd5d4c | ||
|
|
43f8145858 | ||
|
|
79759928f6 | ||
|
|
eb59d28154 | ||
|
|
79f63a2e74 | ||
|
|
6a62254048 | ||
|
|
657a1d75af | ||
|
|
2694def56a | ||
|
|
7843341da3 | ||
|
|
d46314648e | ||
|
|
e45011af57 | ||
|
|
fb09884893 | ||
|
|
d1eecafa63 | ||
|
|
b47d991f56 | ||
|
|
553ea812a7 | ||
|
|
216e374310 | ||
|
|
034b0b8040 | ||
|
|
5ab9e12b46 | ||
|
|
abe6e0d22d | ||
|
|
f5b550191c | ||
|
|
3dcacb3730 | ||
|
|
033589a66b | ||
|
|
e46a647c45 | ||
|
|
f26492fc2d | ||
|
|
3473c3f7b6 | ||
|
|
1b5242b4f9 | ||
|
|
6d897def1b | ||
|
|
2f10e25738 | ||
|
|
555bd257bd | ||
|
|
3afd974dea | ||
|
|
f4120c9d45 | ||
|
|
61cb1cc6f8 | ||
|
|
49bc1d0b3b | ||
|
|
ba23d24dd1 | ||
|
|
556a63de19 | ||
|
|
fae3c4d437 | ||
|
|
89c2ed2a1c | ||
|
|
23f1cb06d6 | ||
|
|
ac92e2dd2d | ||
|
|
bf58425351 | ||
|
|
a3dc0ab398 | ||
|
|
224ebdb8b9 | ||
|
|
cf80d295f3 | ||
|
|
2133869127 | ||
|
|
97330ac621 | ||
|
|
1ee1559506 | ||
|
|
eccc336319 | ||
|
|
7fe657ec71 | ||
|
|
77c07bfd19 | ||
|
|
4de938d97a | ||
|
|
dad1c87afe | ||
|
|
801dbb6d03 | ||
|
|
fa0be82da8 | ||
|
|
7e8bc8d362 | ||
|
|
0bb2a8e0d0 | ||
|
|
2e72b57f2f | ||
|
|
bff1039e3a | ||
|
|
5a999cb77f | ||
|
|
3a2539e0ac | ||
|
|
e262f35d0a | ||
|
|
176bfa6529 | ||
|
|
240c4cf2fd | ||
|
|
db5ec5d876 | ||
|
|
e1dfaf5d87 | ||
|
|
5436154f0d | ||
|
|
809e218d20 | ||
|
|
1eaad6cebb | ||
|
|
56fccecd06 | ||
|
|
3890a947ca | ||
|
|
e299272378 | ||
|
|
70248bd05a | ||
|
|
7a5fde8f5a | ||
|
|
62ba9f1950 | ||
|
|
610b676444 | ||
|
|
58699e3c90 | ||
|
|
9be24a1c9f | ||
|
|
5ace41471e | ||
|
|
3b2106ed30 | ||
|
|
5f4f997126 | ||
|
|
49d397a419 | ||
|
|
ea1ab96749 | ||
|
|
24c62e719a | ||
|
|
9c6b7f688e | ||
|
|
d41dce5ecb | ||
|
|
52a3eafede | ||
|
|
55dfc85159 | ||
|
|
a7a478a19e | ||
|
|
2080afd9de | ||
|
|
9aa136b982 | ||
|
|
3a191f37cb | ||
|
|
429106340f | ||
|
|
530c73b457 | ||
|
|
fb9729fdb9 | ||
|
|
45a09c76ff | ||
|
|
efd65a1b65 | ||
|
|
ae60188eb9 | ||
|
|
3b904525d9 | ||
|
|
1e31f5202f | ||
|
|
f12d41138a | ||
|
|
98369f6a5d | ||
|
|
8f9bf1995b | ||
|
|
e7de3b5f9d | ||
|
|
3541d06d07 | ||
|
|
db0e3cd772 | ||
|
|
d3fee08f9a | ||
|
|
727fb6eabe | ||
|
|
d610c60991 | ||
|
|
3f6e11d26e | ||
|
|
a4577769ae | ||
|
|
7f927d4774 | ||
|
|
e091673f8f | ||
|
|
9842eff887 | ||
|
|
c40b3d3983 | ||
|
|
ac5eefdee4 | ||
|
|
bf508643a5 | ||
|
|
02fc16e97d | ||
|
|
1a83a739dc | ||
|
|
81473f4538 | ||
|
|
e1a847e4d1 | ||
|
|
0f426c3795 | ||
|
|
6df3d169b8 | ||
|
|
5479daa6d4 | ||
|
|
397fec0152 | ||
|
|
d7e644272f | ||
|
|
e91749bbb0 | ||
|
|
bcd1e45ba7 | ||
|
|
4c6b626db6 | ||
|
|
835ba16c27 | ||
|
|
3b6a580b32 | ||
|
|
01c486d486 | ||
|
|
6342a08a16 | ||
|
|
94c8ee11f8 | ||
|
|
9b38980ed9 | ||
|
|
649c536250 | ||
|
|
dd49e2b12d | ||
|
|
f61dab1774 | ||
|
|
40edf00182 | ||
|
|
c35518a865 | ||
|
|
7a0b4428e3 | ||
|
|
c784a15aaa | ||
|
|
ce180de9b8 | ||
|
|
fca9a523e9 | ||
|
|
8a3889be11 | ||
|
|
2a1633621b | ||
|
|
e2deeceb1b | ||
|
|
d4e994de7b | ||
|
|
a60e751217 | ||
|
|
81c5d8a968 | ||
|
|
5b1e4df177 | ||
|
|
4d80744cbb | ||
|
|
e243d4b7ee | ||
|
|
dce35fcb00 | ||
|
|
e45a21b0b6 | ||
|
|
fda563d606 | ||
|
|
f3b49987f8 | ||
|
|
c8c01a5cae | ||
|
|
f7ece90129 | ||
|
|
0f25ef9498 | ||
|
|
5bf2228596 | ||
|
|
227b01395f | ||
|
|
9f52fe1a10 | ||
|
|
affc6c3390 | ||
|
|
951a34dcbf | ||
|
|
36eaa22ed0 | ||
|
|
62df316356 | ||
|
|
00797fdd85 | ||
|
|
9eb39cef05 | ||
|
|
ee6150f67c | ||
|
|
9fa909ccd6 | ||
|
|
b1af544b1d | ||
|
|
7d5b17ac72 | ||
|
|
7a221f2473 | ||
|
|
bdbe956c5c | ||
|
|
8e5b1e6f2f | ||
|
|
257a454515 | ||
|
|
b6aeea425b | ||
|
|
c8e05d1f2a | ||
|
|
a8aa4eb06c | ||
|
|
c1a02cc081 | ||
|
|
e66adc42da | ||
|
|
89938bc21c | ||
|
|
0b2947dedb | ||
|
|
47ddd34266 | ||
|
|
2fdca5d310 | ||
|
|
e5d4e33509 | ||
|
|
e117f613af | ||
|
|
0dfdf02885 | ||
|
|
4a0129fc2b | ||
|
|
a9c705009c | ||
|
|
d937ad8cf6 | ||
|
|
1a08a8219f | ||
|
|
9924c311c9 | ||
|
|
e846e14965 | ||
|
|
36e70228f2 | ||
|
|
a677f1139a | ||
|
|
6f8eba9c28 | ||
|
|
c22c582546 | ||
|
|
ea75509d6e | ||
|
|
ed30bd7b76 | ||
|
|
7090c5ceeb | ||
|
|
bee09c1a0f | ||
|
|
8f9ef4402b | ||
|
|
f26c0cb70f | ||
|
|
81d7ecba2b | ||
|
|
087c3fe1dc | ||
|
|
43ff971dfd | ||
|
|
5c75a98053 | ||
|
|
7ce47402fb | ||
|
|
1e48141648 | ||
|
|
dbda892542 | ||
|
|
b46774be21 | ||
|
|
1073bfba37 | ||
|
|
5dfb4d1195 | ||
|
|
0a2219c5f7 | ||
|
|
ff3149831e | ||
|
|
c935d0558c | ||
|
|
83eb075e3a | ||
|
|
204c2bf09c | ||
|
|
2444522243 | ||
|
|
92eb1cbffd | ||
|
|
8c40ae5a03 | ||
|
|
fa2ee78a5c | ||
|
|
e4a5cdc5bc | ||
|
|
2d73a273af | ||
|
|
761af08889 | ||
|
|
0ee1650f82 | ||
|
|
0e647417f3 | ||
|
|
d1bf5a4882 | ||
|
|
b8414b240c | ||
|
|
3fbdd12b04 | ||
|
|
a3f6bf3e5a | ||
|
|
3a5805db50 | ||
|
|
de8c64e767 | ||
|
|
73d6b15095 | ||
|
|
5d396b9302 | ||
|
|
61d2519111 | ||
|
|
e61c94a846 | ||
|
|
7ed0f61f3f | ||
|
|
85055d1c68 | ||
|
|
e4c469c149 | ||
|
|
9940e8d9f1 | ||
|
|
3dccca1f27 | ||
|
|
22e96a37f8 | ||
|
|
48b1ab5aaf | ||
|
|
0230fa188f | ||
|
|
4118ce876e | ||
|
|
9537bc561d | ||
|
|
ae43c47ca8 | ||
|
|
2fa4060991 | ||
|
|
f9a934759f | ||
|
|
3686b1ffe5 | ||
|
|
ea017a49c3 | ||
|
|
3559f9c776 | ||
|
|
637f57ca71 | ||
|
|
4e60156b45 | ||
|
|
af9946b098 | ||
|
|
b7d4b0f821 | ||
|
|
62ed776a8c | ||
|
|
f880ff21aa | ||
|
|
4a36993c19 | ||
|
|
d87b2f189d | ||
|
|
f9a097a8c0 | ||
|
|
d43358b6dd | ||
|
|
8058f196e1 | ||
|
|
e13e6f34d2 | ||
|
|
c2ff7150aa | ||
|
|
a899621930 | ||
|
|
a0966e1d1d | ||
|
|
e2464382ed | ||
|
|
095bc79dc3 | ||
|
|
1fd3c2488e | ||
|
|
2ee8485886 | ||
|
|
b67c178672 | ||
|
|
7ac4f0a525 | ||
|
|
c4613c51d1 | ||
|
|
77bf17076b | ||
|
|
8dd6beba15 | ||
|
|
a345386967 | ||
|
|
bdd43bd430 | ||
|
|
1716501598 | ||
|
|
d9a5b9178e | ||
|
|
8ca6a9a240 | ||
|
|
ba75a3884c | ||
|
|
d91d89eef6 | ||
|
|
a726c91116 | ||
|
|
d00fe95f10 | ||
|
|
072b7a014e | ||
|
|
618ce115d7 | ||
|
|
d973aa82fe | ||
|
|
3a85b6b7c6 | ||
|
|
2c22ff175c | ||
|
|
6bc43a4198 | ||
|
|
e348b3deeb | ||
|
|
6724b9a583 | ||
|
|
41c35b2218 | ||
|
|
4477d76f03 | ||
|
|
14f5f6235a | ||
|
|
739350fd8e | ||
|
|
14ed97102b | ||
|
|
db389058fa | ||
|
|
b557d04007 | ||
|
|
52c5da997b | ||
|
|
57d198f99a | ||
|
|
a3ab17b470 | ||
|
|
9bf3141893 | ||
|
|
d35eb6a0c3 | ||
|
|
37aad2e3aa | ||
|
|
efc5d0699a | ||
|
|
893bc9f777 | ||
|
|
61b8729ef9 | ||
|
|
b89d3cc4d0 | ||
|
|
e8cc11ea34 | ||
|
|
2e804511ca | ||
|
|
b6790c491b | ||
|
|
c95e2b009e | ||
|
|
d5615a67c8 | ||
|
|
d9b9bbd4a8 | ||
|
|
d780b1eede | ||
|
|
608adf15a3 | ||
|
|
1717391f6c | ||
|
|
2e6e9ff6f8 | ||
|
|
23c903074c | ||
|
|
94030a12cf | ||
|
|
f63d7de9da | ||
|
|
13ee6792df | ||
|
|
6302444f34 | ||
|
|
61c5e4b54a | ||
|
|
d6118871be | ||
|
|
94b27e8933 | ||
|
|
05500dc5f8 | ||
|
|
c5a72971fe | ||
|
|
5bc6486e3b | ||
|
|
59e18bce0a | ||
|
|
898c5b6df5 | ||
|
|
9cd422791a | ||
|
|
91edebf1fe | ||
|
|
df8a5792f1 | ||
|
|
cda7b417cd | ||
|
|
d2ac35af26 | ||
|
|
6caeff2408 | ||
|
|
83d1a46526 | ||
|
|
d1bd160b0a | ||
|
|
bc88a8bb03 | ||
|
|
04cfb984ae | ||
|
|
02a245941a | ||
|
|
7fb1352aa1 | ||
|
|
4c555bad2e | ||
|
|
75c789bab4 | ||
|
|
626d020e62 | ||
|
|
3830117735 | ||
|
|
042cee8e36 | ||
|
|
03cc5b47e9 | ||
|
|
46fa45942e | ||
|
|
0cb4104aa7 | ||
|
|
f2bbc5fbc4 | ||
|
|
16340ce811 | ||
|
|
2cf8153f4a | ||
|
|
2f00287e45 | ||
|
|
0de17f64e9 | ||
|
|
c30838878f | ||
|
|
bd31281f1e | ||
|
|
7fc54ed98e | ||
|
|
0abdcedcab | ||
|
|
6c05353086 | ||
|
|
e7575bf380 | ||
|
|
89ace85903 | ||
|
|
68a91d66b7 | ||
|
|
724b5bf4fe | ||
|
|
d6da9211bc | ||
|
|
f45abac27f | ||
|
|
00b9a1d87d | ||
|
|
20b835b5a4 | ||
|
|
7bb1a474df | ||
|
|
750ee35dbf | ||
|
|
fda5e1f543 | ||
|
|
78d090aea5 | ||
|
|
7362569cf5 | ||
|
|
f5b1c7e5f1 | ||
|
|
c554cdac4c | ||
|
|
41b624ea1b | ||
|
|
7cdcaadcf5 | ||
|
|
4ad33d3c3b | ||
|
|
2778ac21de | ||
|
|
cb3cd57926 | ||
|
|
ba6815d413 | ||
|
|
52004cdde8 | ||
|
|
1d2045cb61 | ||
|
|
357e2e404a | ||
|
|
38e5640cda | ||
|
|
c4c731bd9a | ||
|
|
04d27acd60 | ||
|
|
80f0303b21 | ||
|
|
d651d9b427 | ||
|
|
3b2648bd5e | ||
|
|
73cc11f000 | ||
|
|
637de0149c | ||
|
|
855575e5a7 | ||
|
|
ed2999a163 | ||
|
|
a18c16e19e | ||
|
|
9032ab2eec | ||
|
|
03f66b8d74 | ||
|
|
8c30ae7c65 | ||
|
|
453c9c9199 | ||
|
|
993e370f92 | ||
|
|
2bcd3a3acc | ||
|
|
c54c632ca1 | ||
|
|
28a4a35625 | ||
|
|
e7577d7bb4 | ||
|
|
27ea0623d7 | ||
|
|
390e2bbddc | ||
|
|
b50fc08f39 | ||
|
|
b2ce7e8d84 | ||
|
|
2b1c6d3cf8 | ||
|
|
c658305a1b | ||
|
|
63235d8f94 | ||
|
|
d702227af0 | ||
|
|
b7251dbea5 | ||
|
|
144b7f3386 | ||
|
|
9583dc820f | ||
|
|
a03076f2d8 | ||
|
|
d76fa22b4b | ||
|
|
f960831f10 | ||
|
|
b0fb95dfc9 | ||
|
|
bca9566849 | ||
|
|
8760de42fe | ||
|
|
2c02efd1fe | ||
|
|
4b4a63ed44 | ||
|
|
64f434eca4 | ||
|
|
f4e85a53e7 | ||
|
|
f8176a74ec | ||
|
|
e60a96a71a | ||
|
|
216e2607ca | ||
|
|
53f8026018 | ||
|
|
de92ce7a88 | ||
|
|
eb8041b943 | ||
|
|
9c6e9bcf33 | ||
|
|
154816ffd0 | ||
|
|
c86e425df6 | ||
|
|
3883c7a190 | ||
|
|
a66760d86d | ||
|
|
52752659c1 | ||
|
|
f676c0c41b | ||
|
|
f31e993f09 | ||
|
|
56f610e548 | ||
|
|
052a6a0acc | ||
|
|
77037e33c9 | ||
|
|
5a34799554 | ||
|
|
47282abfa4 | ||
|
|
c9cc724b31 | ||
|
|
0d3674245b | ||
|
|
82b21cdf4a | ||
|
|
c4592f577a | ||
|
|
3cd851e578 | ||
|
|
e074833a7d | ||
|
|
c5f1a83cb4 | ||
|
|
1baaa778ee | ||
|
|
6a948d5afd | ||
|
|
ea66ae0811 | ||
|
|
bf8a155fb1 | ||
|
|
4ae59bef96 | ||
|
|
eadf5dcb2d | ||
|
|
91a24e8229 | ||
|
|
e3c979a7a4 | ||
|
|
05365706c0 | ||
|
|
bbca31b661 | ||
|
|
eb7fc12e01 | ||
|
|
98ae7b1210 | ||
|
|
51877cecf7 | ||
|
|
9053b2000b | ||
|
|
dd6ce5f9d8 | ||
|
|
9a8301fc74 | ||
|
|
aabe2a0a30 | ||
|
|
c79fb6fcdd | ||
|
|
af9ba3be91 | ||
|
|
6f24d038f8 | ||
|
|
cf65893c4b | ||
|
|
bd7d5a429f | ||
|
|
7b54f6e642 | ||
|
|
422c0dfb5e | ||
|
|
73b296918b | ||
|
|
907c201693 | ||
|
|
58de8bf392 | ||
|
|
a89a7a783a | ||
|
|
c422010597 | ||
|
|
08e1d9ffad | ||
|
|
a4e8dc3371 | ||
|
|
19da56a6ea | ||
|
|
d3c06c39f9 | ||
|
|
6301620428 | ||
|
|
a6f157f346 | ||
|
|
8d4417ec92 | ||
|
|
0b55be2581 | ||
|
|
88a59fd0ca | ||
|
|
539674614b | ||
|
|
9d1b9157d4 | ||
|
|
5f449045d2 | ||
|
|
3e4d236751 | ||
|
|
4fe6593fbe | ||
|
|
635633379a | ||
|
|
48fecd791d | ||
|
|
a325a20fb4 | ||
|
|
1f0916b01b | ||
|
|
eb767ab15f | ||
|
|
92c0aa3854 | ||
|
|
a61016cb55 | ||
|
|
eb7ddd6e11 | ||
|
|
ff3d2e42f4 | ||
|
|
1aab123b6c | ||
|
|
d11f8d294f | ||
|
|
04ded881f6 | ||
|
|
4f9bf5312b | ||
|
|
7cf8f59987 | ||
|
|
b8b5c8e8c9 | ||
|
|
a46baf7685 | ||
|
|
f2a51aa37c | ||
|
|
233eaf8ee9 | ||
|
|
067be2c551 | ||
|
|
550e1feaec | ||
|
|
f90ce23f30 | ||
|
|
29f8f8fe68 | ||
|
|
48c1e7b00d | ||
|
|
2175ccedd2 | ||
|
|
d4e74f20aa | ||
|
|
aa5bc39311 | ||
|
|
46049b4236 | ||
|
|
683ebef6c6 | ||
|
|
5010e95c23 | ||
|
|
46b7a270a6 | ||
|
|
cf497c2728 | ||
|
|
16fcd07110 | ||
|
|
a9a2798910 | ||
|
|
9cd664caa3 | ||
|
|
a90e0c6595 | ||
|
|
7b5efaf7b0 | ||
|
|
3b7ca4ac35 | ||
|
|
40a61b82ce | ||
|
|
028f43299a | ||
|
|
3a4727f0f5 | ||
|
|
fec89f95fb | ||
|
|
5681d41f76 | ||
|
|
efd61d97ef | ||
|
|
3ed56f2192 | ||
|
|
122462b9b1 | ||
|
|
2217b9277e | ||
|
|
b5e0e3631b | ||
|
|
be68e43871 | ||
|
|
f6034c0882 | ||
|
|
f693781bf0 | ||
|
|
3ae9be987f | ||
|
|
ec0975c388 | ||
|
|
c2ce484e93 | ||
|
|
e5c7c314a7 | ||
|
|
6d36dcd46e | ||
|
|
96c9ecd20e | ||
|
|
997be9a036 | ||
|
|
31fd8e98b9 | ||
|
|
aa0f874c8d | ||
|
|
5c59484d2b | ||
|
|
fba6211c99 | ||
|
|
a8386e7d71 | ||
|
|
04b262d8f1 | ||
|
|
4dbbc24a44 | ||
|
|
725d50554a | ||
|
|
ed91cafce2 | ||
|
|
de48a5ac9c | ||
|
|
1d167f4680 | ||
|
|
efad7ee197 | ||
|
|
820c88ea73 | ||
|
|
e7f031c9b3 | ||
|
|
f3f6924b61 | ||
|
|
c5244abad9 | ||
|
|
1f5954e2c1 | ||
|
|
e046a2a6da | ||
|
|
8395b53400 | ||
|
|
24ec14738d | ||
|
|
79477fdfe4 | ||
|
|
7ec0543af3 | ||
|
|
e73e3cb4ba | ||
|
|
317d9c4559 | ||
|
|
5247de552a | ||
|
|
37b107b90b | ||
|
|
17ff41af47 | ||
|
|
772f647a73 | ||
|
|
5c4facd9dc | ||
|
|
40ad1df6ee | ||
|
|
c49da4c6f7 | ||
|
|
d1cc87ba28 | ||
|
|
89be1d496a | ||
|
|
69e114c5c4 | ||
|
|
5d9a4ce90c | ||
|
|
84f1037b8f | ||
|
|
120af801cf | ||
|
|
f3d09ce7c8 | ||
|
|
2b9323529f | ||
|
|
971ecee171 | ||
|
|
4640d1a28e | ||
|
|
8b461a7456 | ||
|
|
2fa1238b8a | ||
|
|
55ae5dab2b | ||
|
|
fa41183a53 | ||
|
|
959aa0f595 | ||
|
|
069752cb42 | ||
|
|
0c537837d9 | ||
|
|
f19852a738 | ||
|
|
61cade6222 | ||
|
|
a4e3a0dd97 | ||
|
|
22a6cd3a26 | ||
|
|
7f10828dfa | ||
|
|
04264c6338 | ||
|
|
13393c76dc | ||
|
|
13c12ca83d | ||
|
|
7fffd408af | ||
|
|
089b04c8a9 | ||
|
|
b192dacc13 | ||
|
|
250a45ab15 | ||
|
|
3b44b87137 | ||
|
|
26c16b9fd3 | ||
|
|
0bd40bae6e | ||
|
|
246ccf09b9 | ||
|
|
9452f416bf | ||
|
|
1e0e6ee573 | ||
|
|
be0e53c07b | ||
|
|
9dd58196e3 | ||
|
|
66b4999765 | ||
|
|
403e201e1a | ||
|
|
77a55fbe5c | ||
|
|
90c1608d88 | ||
|
|
7a51640262 | ||
|
|
13946e7db7 | ||
|
|
e009c002ba | ||
|
|
d24e0cc6cc | ||
|
|
5b8131e2d3 | ||
|
|
8fc25cc567 | ||
|
|
77ebb95d3d | ||
|
|
f142b1c22f | ||
|
|
1c9159d6a0 | ||
|
|
82e15dc6dc | ||
|
|
ee68f9298b | ||
|
|
5c6ec78789 | ||
|
|
4ac0d3ad40 | ||
|
|
c7209ef231 | ||
|
|
0249c16b04 | ||
|
|
f43d34899d | ||
|
|
19daefd04e | ||
|
|
ec5e984ed9 | ||
|
|
88de3cfecc | ||
|
|
a654f41ddb | ||
|
|
fbf2462325 | ||
|
|
85e4831198 | ||
|
|
091dc29f72 | ||
|
|
59d1986660 | ||
|
|
db4fa48f66 | ||
|
|
f2b83ece10 | ||
|
|
860b52273e | ||
|
|
bafceb56fb | ||
|
|
9271b3662a | ||
|
|
554013ca9f | ||
|
|
3250fdc2ca | ||
|
|
3678d34b16 | ||
|
|
16276853a1 | ||
|
|
f10c24e404 | ||
|
|
6f5fd72738 | ||
|
|
103a491ac0 | ||
|
|
929f90344e | ||
|
|
a963052d64 | ||
|
|
898613e14f | ||
|
|
b84e63d503 | ||
|
|
63870d2830 | ||
|
|
54e46f5984 | ||
|
|
0096eca7fe | ||
|
|
ce3acbd30a | ||
|
|
c5ae5524ff | ||
|
|
fbf5a8123b | ||
|
|
edbd6ad584 | ||
|
|
faf11c4a46 | ||
|
|
68a9e5f963 | ||
|
|
fa7f0ef44f | ||
|
|
bcfe7afbfd | ||
|
|
46e6e8984d | ||
|
|
0f057bd440 | ||
|
|
ba91a76f5f | ||
|
|
c09e005cc8 | ||
|
|
2c42629c51 | ||
|
|
f93e5a39e5 | ||
|
|
02eafe94b3 | ||
|
|
7d914768bb | ||
|
|
db6541b24c | ||
|
|
228566c0a1 | ||
|
|
1e4bcf3367 | ||
|
|
51e7d26053 | ||
|
|
e42627d2cb | ||
|
|
548d4eed95 | ||
|
|
8a5034d289 | ||
|
|
5a68641f27 | ||
|
|
ce28584dda | ||
|
|
ab870dd691 | ||
|
|
aed0126102 | ||
|
|
d0db1bf9b3 | ||
|
|
90ba606633 | ||
|
|
5b80cb8b6b | ||
|
|
e6ca604d24 | ||
|
|
9940b7f853 | ||
|
|
faca9276e9 | ||
|
|
5a7e463ef6 | ||
|
|
27c5a2825a | ||
|
|
e9d939ff2d | ||
|
|
88e8eaa575 | ||
|
|
3bbcf89105 | ||
|
|
1794bdc663 | ||
|
|
bcf97ebf1f | ||
|
|
a1496547fd | ||
|
|
0befa06cd0 | ||
|
|
407b8c179b | ||
|
|
aafee25d58 | ||
|
|
adb602dbfe | ||
|
|
085b6bede8 | ||
|
|
096aab592b | ||
|
|
2f117982e9 | ||
|
|
b05603eb6c | ||
|
|
9344b0b3a8 | ||
|
|
89ea1171db | ||
|
|
28968caf33 | ||
|
|
16fd1c2352 | ||
|
|
b942f61272 | ||
|
|
e3d1badfcf | ||
|
|
76f6a9e597 | ||
|
|
69dd1d2544 | ||
|
|
dd65ac56ef | ||
|
|
c796d84fca | ||
|
|
525db875b0 | ||
|
|
e73038cbcb | ||
|
|
00a8edb4a0 | ||
|
|
ee7e0d05f5 | ||
|
|
6357dc8a91 | ||
|
|
5bd95b3ce1 | ||
|
|
be06983c80 | ||
|
|
55bdc1fa16 | ||
|
|
a634c22ae0 | ||
|
|
859ee23d2e | ||
|
|
b7671dafc8 | ||
|
|
541484d142 | ||
|
|
f531ca3b48 | ||
|
|
0da7264e75 | ||
|
|
7f3bcdb4cc | ||
|
|
5eaa51eeff | ||
|
|
7b64b890d7 | ||
|
|
ccc201ea5f | ||
|
|
e6578857cf | ||
|
|
320c22f1f5 | ||
|
|
e2af5890f3 | ||
|
|
36b1c0898c | ||
|
|
94441dcbee | ||
|
|
c723cdf808 | ||
|
|
c2ee0d9c84 | ||
|
|
e8780f1ec6 | ||
|
|
783fd73ea1 | ||
|
|
74eb293733 | ||
|
|
42ea4d257b | ||
|
|
a849edf19a | ||
|
|
0cbd59856c | ||
|
|
698ba57597 | ||
|
|
27ce6a85e9 | ||
|
|
ae290ab374 | ||
|
|
ab602c9d14 | ||
|
|
2e53af1b75 | ||
|
|
a725e065d9 | ||
|
|
db7e23b423 | ||
|
|
dc8493535d | ||
|
|
10a395ca33 | ||
|
|
522c7ade91 | ||
|
|
a3d6099892 | ||
|
|
280028290e | ||
|
|
c195139d31 | ||
|
|
6f1b03415c | ||
|
|
ffcb015581 | ||
|
|
67a2ac292b | ||
|
|
6674b2a70c | ||
|
|
c855d6bb9a | ||
|
|
1086528ab7 | ||
|
|
c26dd6b76f | ||
|
|
d3b6f75848 | ||
|
|
d1efdcd78e | ||
|
|
95ab5adda1 | ||
|
|
c5eb36fe9d | ||
|
|
e3e3a8a695 | ||
|
|
24ebf95f33 | ||
|
|
54465c92cc | ||
|
|
f7c4b3a922 | ||
|
|
50dfa64a54 | ||
|
|
c6b8ffbb61 | ||
|
|
3e81dcdfc2 | ||
|
|
782b740c95 | ||
|
|
3fd6fa6f86 | ||
|
|
6a201f7962 | ||
|
|
80a864c52c | ||
|
|
c8eea49909 | ||
|
|
95c354fe81 | ||
|
|
6935f82389 | ||
|
|
719bb18316 | ||
|
|
a8a7701f60 | ||
|
|
2924ebc124 | ||
|
|
f587a5f4f0 | ||
|
|
946b4f4b86 | ||
|
|
d0a5e86da1 | ||
|
|
2e0b19f63f | ||
|
|
9861f3d435 | ||
|
|
482a6e9840 | ||
|
|
6a8700d86c | ||
|
|
1733b24f9d | ||
|
|
c85055bb03 | ||
|
|
280f05b174 | ||
|
|
990b0f1c15 | ||
|
|
6f76a6db66 | ||
|
|
0c2834edb7 | ||
|
|
f1ba45723c | ||
|
|
b523eef294 | ||
|
|
bf30b2831b | ||
|
|
642cd3bebf | ||
|
|
057dd6c590 | ||
|
|
0bd7db9efe | ||
|
|
f678c97346 | ||
|
|
887e81188f | ||
|
|
8d0140aabe | ||
|
|
2a8f275a28 | ||
|
|
55c3150946 | ||
|
|
b56e16acd0 | ||
|
|
b75186533d | ||
|
|
8958efba60 | ||
|
|
a9707a5728 | ||
|
|
7635feb591 | ||
|
|
087c2917aa | ||
|
|
deddedd88f | ||
|
|
b38294f236 | ||
|
|
fdb9872cef | ||
|
|
f8dd5d5088 | ||
|
|
9e0207e534 | ||
|
|
9eae789cd2 | ||
|
|
d6104935d7 | ||
|
|
406af5916c | ||
|
|
93e4e4f4fb | ||
|
|
8a05de537f | ||
|
|
8a92687d9a | ||
|
|
3432e7edcd | ||
|
|
3c6c17abcd | ||
|
|
11d237c252 | ||
|
|
0f7b6ec5ac | ||
|
|
b4526c4e6e | ||
|
|
3eaaa0f286 | ||
|
|
b1c8071163 | ||
|
|
3468108d4c | ||
|
|
33c8dd4ee5 | ||
|
|
5e2c4caa32 | ||
|
|
7c989ca487 | ||
|
|
e9a2982ecd | ||
|
|
f5a55a81f7 | ||
|
|
340f2c80a0 | ||
|
|
bb144436c7 | ||
|
|
b50d3ba805 | ||
|
|
00e7158381 | ||
|
|
221bef48c0 | ||
|
|
afcc1ba706 | ||
|
|
bf88a62a16 | ||
|
|
cc140744d6 | ||
|
|
354e8ffb82 | ||
|
|
e1c828be3e | ||
|
|
d50dc9f649 | ||
|
|
07695b3622 | ||
|
|
be15a9261a | ||
|
|
1fa2313aef | ||
|
|
26e266a951 | ||
|
|
208edaa3d1 | ||
|
|
f6a258b4a8 | ||
|
|
db08581352 | ||
|
|
0afeb68e6c | ||
|
|
a809c9ac5f | ||
|
|
45e9f35654 | ||
|
|
edd5c8b44d | ||
|
|
7238a3ee89 | ||
|
|
bbcab800c9 | ||
|
|
5564c78e53 | ||
|
|
792b81725e | ||
|
|
b101efe26e | ||
|
|
becc34a159 | ||
|
|
1273c6f3d4 | ||
|
|
82458d4de0 | ||
|
|
7066cc17bb | ||
|
|
12ed2f65e3 | ||
|
|
90bc187355 | ||
|
|
5ecaaea90b | ||
|
|
f9fc8674eb | ||
|
|
039e81b04b | ||
|
|
efb4315a1e | ||
|
|
f53d33ba34 | ||
|
|
9b776dc7ab | ||
|
|
1d64a1dcbb | ||
|
|
7c92994f10 | ||
|
|
bf97cc7efa | ||
|
|
4f5e9e939b | ||
|
|
92ad35848a | ||
|
|
bb69b20aff | ||
|
|
80e93621e1 | ||
|
|
31ff506309 | ||
|
|
4a51ddf741 | ||
|
|
3d1dc636d0 | ||
|
|
8609ba28d0 | ||
|
|
685f5ebbd1 | ||
|
|
4e2f8145f5 | ||
|
|
11b63d3417 | ||
|
|
2c81bc35dc | ||
|
|
b8ce1b4e69 | ||
|
|
23c2717ab2 | ||
|
|
132afbe83b | ||
|
|
ef52d15edd | ||
|
|
6df2f9e5ba | ||
|
|
eb9be4e884 | ||
|
|
0674f32d79 | ||
|
|
49cae0904f | ||
|
|
40685a0e61 | ||
|
|
4772a4986b | ||
|
|
c973a1f875 | ||
|
|
50d066befb | ||
|
|
c35e48291d | ||
|
|
511278b66a | ||
|
|
514a11346d | ||
|
|
2eb75bb941 | ||
|
|
9922ce97bf | ||
|
|
3ed4127297 | ||
|
|
c83e608cce | ||
|
|
3e2ae15882 | ||
|
|
3047702ded | ||
|
|
05cae4911d | ||
|
|
8c34eaad15 | ||
|
|
0492eabff1 | ||
|
|
7797e084f9 | ||
|
|
b40aa66985 | ||
|
|
76c06c5f2a | ||
|
|
83538c745a | ||
|
|
f266741f40 | ||
|
|
4795a5c5d1 | ||
|
|
c14cb62cd7 | ||
|
|
b3ec01521e | ||
|
|
6483df5ee4 | ||
|
|
6275d69a36 | ||
|
|
6300c8df56 | ||
|
|
366bf4eb0c | ||
|
|
21b358c742 | ||
|
|
7a0303f7ae | ||
|
|
64165ea4c8 | ||
|
|
c8fc789393 | ||
|
|
f145e1de0f | ||
|
|
36dee7d892 | ||
|
|
98ae30b513 | ||
|
|
073edd914d | ||
|
|
316b520ffb | ||
|
|
25e459659a | ||
|
|
fdebb022e4 | ||
|
|
ed1739acbd | ||
|
|
1f81919d4a | ||
|
|
436b5dc20c | ||
|
|
0c867b21ff | ||
|
|
4cacb622eb | ||
|
|
24acb09a2a | ||
|
|
ec45cdba84 | ||
|
|
4ca134a41c | ||
|
|
b85eae2aea | ||
|
|
aee58a8c17 | ||
|
|
22f3e21266 | ||
|
|
d0de1ed2e4 | ||
|
|
807fcf07d9 | ||
|
|
f5faff9020 | ||
|
|
769a52df16 | ||
|
|
dfb94290ae | ||
|
|
f366a636e6 | ||
|
|
a7c2f28f06 | ||
|
|
79e198451c | ||
|
|
844c959912 | ||
|
|
19ec8f4a77 | ||
|
|
f5aeda359c | ||
|
|
5a5687a506 | ||
|
|
7e9bfa51e9 | ||
|
|
c7d60279f7 | ||
|
|
7d49c65dd0 | ||
|
|
32dfbad414 | ||
|
|
abd44ca7c5 | ||
|
|
44f4ff9d37 | ||
|
|
658bee17e9 | ||
|
|
524ce01423 | ||
|
|
41f59ffc78 | ||
|
|
d7f52fd7e5 | ||
|
|
1f9db97d33 | ||
|
|
f806d8818d | ||
|
|
1a538509d0 | ||
|
|
b2d00b2a86 | ||
|
|
31f6093513 | ||
|
|
b9bddeff39 | ||
|
|
54c2f622a4 | ||
|
|
d55b56edd3 | ||
|
|
8d6fdb7a3e | ||
|
|
dceaae33ed | ||
|
|
e8995b85b8 | ||
|
|
925a3cfad7 | ||
|
|
c99a44b122 | ||
|
|
439d3107f9 | ||
|
|
afc593676a | ||
|
|
17d7af6ccc | ||
|
|
0b982d3316 | ||
|
|
26da14f315 | ||
|
|
2de7e03698 | ||
|
|
3d2fbed55f | ||
|
|
0e445ec0f5 | ||
|
|
31055d88a5 | ||
|
|
0d125725bc | ||
|
|
8b09b5b3cd | ||
|
|
2d8a699515 | ||
|
|
0d95507909 | ||
|
|
8e722d8fee | ||
|
|
03292d10cc | ||
|
|
cfc9e8b2fa | ||
|
|
f382696ccf | ||
|
|
e8fcc7e74c | ||
|
|
2bd9c9247c | ||
|
|
fc235317fe | ||
|
|
82d9163955 | ||
|
|
4a354befe5 | ||
|
|
212936eb52 | ||
|
|
05afedd950 | ||
|
|
a36c01372d | ||
|
|
9b48da5b4e | ||
|
|
c93f79f0f3 | ||
|
|
89a5152f7d | ||
|
|
47bd9cdf2f | ||
|
|
84255f4f4f | ||
|
|
668a36a652 | ||
|
|
30ff7413be | ||
|
|
af1cc0717b | ||
|
|
5e3365d233 | ||
|
|
4f780a01f9 | ||
|
|
dc6a832cc3 | ||
|
|
164ba823e5 | ||
|
|
8dd7fe82ff | ||
|
|
6c1032548b | ||
|
|
f0eeb16b33 | ||
|
|
c88b0d20e8 | ||
|
|
fbecae7362 | ||
|
|
38ba5fbceb | ||
|
|
d47758a540 | ||
|
|
dac18e3bf8 | ||
|
|
c4f44c7bcb | ||
|
|
73ad3d418d | ||
|
|
36276c41b2 | ||
|
|
d40f566e41 | ||
|
|
cd9b526203 | ||
|
|
caabc4ec44 | ||
|
|
73e7a2bea8 | ||
|
|
e463587bad | ||
|
|
e571b6a656 | ||
|
|
710499cf46 | ||
|
|
32a5c2c1f6 | ||
|
|
91dcb958e0 | ||
|
|
9a5b9253c4 | ||
|
|
215af5c60a | ||
|
|
8734c2466c | ||
|
|
0556687584 | ||
|
|
094e80f4a4 | ||
|
|
c13a0953c8 | ||
|
|
9f1f174c99 | ||
|
|
7e0a4c66e7 | ||
|
|
62b1056860 | ||
|
|
a3181dbead | ||
|
|
02c02283cf | ||
|
|
4d93da9f68 | ||
|
|
4a6086a14b | ||
|
|
0a34a2d5d8 | ||
|
|
a394b675b0 | ||
|
|
04846b10bc | ||
|
|
f9501e97a2 | ||
|
|
3ef788765a | ||
|
|
8e16931949 | ||
|
|
2267aca296 | ||
|
|
c70bc7ed0b | ||
|
|
8e3b81c5ec | ||
|
|
30975f7116 | ||
|
|
0ef463d56a | ||
|
|
5132f5bfe6 | ||
|
|
80457018d7 | ||
|
|
b0997d05fb | ||
|
|
3add2f0acb | ||
|
|
166d1811a1 | ||
|
|
e1fc455079 | ||
|
|
98237bf942 | ||
|
|
75f21f23ff | ||
|
|
9885aeac3b | ||
|
|
85c87b9ab9 | ||
|
|
51cd78e16c | ||
|
|
e6a40af06d | ||
|
|
3fcbb4ac25 | ||
|
|
7d71bad4eb | ||
|
|
dbdfed6343 | ||
|
|
5e48c1fadc | ||
|
|
deb6dd7f72 | ||
|
|
c265673c8e | ||
|
|
0fceeb20f1 | ||
|
|
c5897e0d62 | ||
|
|
8d13f22c50 | ||
|
|
1815536534 | ||
|
|
9267c25aa0 | ||
|
|
281cbbdf2e | ||
|
|
5996d671a0 | ||
|
|
ef9b974bcd | ||
|
|
7e66b73ce0 | ||
|
|
505a2097ad | ||
|
|
07380878fb | ||
|
|
3b29ae3c99 | ||
|
|
e5617b5fd1 | ||
|
|
11f23ae663 | ||
|
|
2828003d60 | ||
|
|
16cef3b4c6 | ||
|
|
699f39e3cf | ||
|
|
33b6a7381b | ||
|
|
190673b24a | ||
|
|
b7b03dbd4a | ||
|
|
56009dd16e | ||
|
|
b56bde3f61 | ||
|
|
b1ed74eb43 | ||
|
|
d8f0e7cbd1 | ||
|
|
5e721afb5d | ||
|
|
149c01a86a | ||
|
|
51322a1055 | ||
|
|
c5bc802ff0 | ||
|
|
6b88d3b5d0 | ||
|
|
ecc1f92787 | ||
|
|
d4f76fbe26 | ||
|
|
1dd72693f9 | ||
|
|
fe1013e779 | ||
|
|
84ca5172f0 | ||
|
|
7c49255c2a | ||
|
|
a5a9c42185 | ||
|
|
5f8a6cea6f | ||
|
|
50212805aa | ||
|
|
cd7feb0148 | ||
|
|
974f2f78a9 | ||
|
|
250b36eeb1 | ||
|
|
6f72164bbe | ||
|
|
ba8d960c8f | ||
|
|
84421a7c68 | ||
|
|
5c7325f44a | ||
|
|
c45b498a8b | ||
|
|
a4261dcc9c | ||
|
|
d1ecdf7441 | ||
|
|
088ca033f8 | ||
|
|
5b7dd32c20 | ||
|
|
eb94395f3d | ||
|
|
22f5fc5739 | ||
|
|
e994cacbfe | ||
|
|
3114d41cb7 | ||
|
|
968b2ece43 | ||
|
|
feed54caef | ||
|
|
4eddcb344e | ||
|
|
2ae06a7a01 | ||
|
|
25945718a1 | ||
|
|
254188f38f | ||
|
|
3601c39177 | ||
|
|
02f7bb0d4c | ||
|
|
565d72ef36 | ||
|
|
3806623c23 | ||
|
|
0fa12839a5 | ||
|
|
a257a613d7 | ||
|
|
0a752b9fab | ||
|
|
eeec0d63c2 | ||
|
|
04d6b5da2f | ||
|
|
1dfd3b8aa3 | ||
|
|
0873821b98 | ||
|
|
0a9cbd47c7 | ||
|
|
b61027b48d | ||
|
|
53701891a1 | ||
|
|
68b462d057 | ||
|
|
649f789190 | ||
|
|
7b3e319398 | ||
|
|
5494c1858e | ||
|
|
c5763e59d5 | ||
|
|
b090c73bd4 | ||
|
|
2b9a408ccc | ||
|
|
83c35bd6b5 | ||
|
|
98b012a04e | ||
|
|
a9af896ddd | ||
|
|
309dca8179 | ||
|
|
8144cd24d6 | ||
|
|
0ce8191be5 | ||
|
|
595f2582fa | ||
|
|
da83bd8265 | ||
|
|
799cc37c22 | ||
|
|
35ba817128 | ||
|
|
29a61950dd | ||
|
|
acd39eaab5 | ||
|
|
3d55b54f3d | ||
|
|
daae3500dd | ||
|
|
64fe9ec048 | ||
|
|
cb80a70aca | ||
|
|
24398d2b9d | ||
|
|
d4a2d70089 | ||
|
|
9add72e9d6 | ||
|
|
e7fc908ff1 | ||
|
|
4ffca0f4b4 | ||
|
|
a0f3e94655 | ||
|
|
6485a6cdc0 | ||
|
|
931f5cdd33 | ||
|
|
3975d76f23 | ||
|
|
bf6602bc1b | ||
|
|
a85ffc66ae | ||
|
|
828267aaa3 | ||
|
|
a77c615909 | ||
|
|
cfdf4c92f7 | ||
|
|
0f9fb37c78 | ||
|
|
673bce936e | ||
|
|
1f83635267 | ||
|
|
2d7e1b5804 | ||
|
|
085cf36199 | ||
|
|
ceb4a3ecc0 | ||
|
|
cf7795ce64 | ||
|
|
223dc78acb | ||
|
|
f63cd12569 | ||
|
|
65afeba19a | ||
|
|
791f73e0db | ||
|
|
8ded453ab0 | ||
|
|
e443454c4b | ||
|
|
1dd9a58e5a | ||
|
|
b628bcee27 | ||
|
|
dfc0cbf3a8 | ||
|
|
512a92895f | ||
|
|
6ab425f130 | ||
|
|
f5b9ee53a3 | ||
|
|
ea073f58cf | ||
|
|
bef5c4acb8 | ||
|
|
b5b3c0eaf8 | ||
|
|
1fb80bf0e2 | ||
|
|
436332d5f2 | ||
|
|
fe8c12c798 | ||
|
|
1cc59010f5 | ||
|
|
878c1cd936 | ||
|
|
5170c4898a | ||
|
|
2054e3c026 | ||
|
|
ffbe05af9b | ||
|
|
84f95a09d7 | ||
|
|
573410afab | ||
|
|
619939ccd9 | ||
|
|
714a5d1dc4 | ||
|
|
bc42dbdf87 | ||
|
|
765b5437bd | ||
|
|
5d7b38cabf | ||
|
|
debf1fce54 | ||
|
|
0045f2fb61 | ||
|
|
5764b55aee | ||
|
|
5e3a41dbd2 | ||
|
|
88d0f24ce7 | ||
|
|
eb6e3ba8b3 | ||
|
|
528c301891 | ||
|
|
f7ae0cb78f | ||
|
|
3695ba5882 | ||
|
|
4c95d2cfdc | ||
|
|
cc6a8b6e15 | ||
|
|
51d8e6aa28 | ||
|
|
f0600c1d5f | ||
|
|
90da66261a | ||
|
|
82c2dafb23 | ||
|
|
bfdd26c541 | ||
|
|
e699f6d1bd | ||
|
|
fae65ebc61 | ||
|
|
f744c3534d | ||
|
|
9ce40761c8 | ||
|
|
48924009fe | ||
|
|
d497fb6966 | ||
|
|
5bc7f150f8 | ||
|
|
a6eda344a4 | ||
|
|
1aa52e5e1e | ||
|
|
769f06cea2 | ||
|
|
8d90588020 | ||
|
|
9cf63c99cf | ||
|
|
4a0f77650b | ||
|
|
b53679a24d | ||
|
|
b06845c545 | ||
|
|
c55b6ee544 | ||
|
|
045f545085 | ||
|
|
038b63f7f7 | ||
|
|
d3f4c816c7 | ||
|
|
72aa6be38d | ||
|
|
444a268ce0 | ||
|
|
17a38faa43 | ||
|
|
24385ff56e | ||
|
|
f51bc8e9b9 | ||
|
|
6f5bf45212 | ||
|
|
3af8f53097 | ||
|
|
6c6b0e2395 | ||
|
|
26351522c5 | ||
|
|
dec2e4788e | ||
|
|
f9cd736b33 | ||
|
|
553dd00741 | ||
|
|
88634dac3a | ||
|
|
83924d0864 | ||
|
|
22bde5b277 | ||
|
|
cdbdf74811 | ||
|
|
db16702263 | ||
|
|
5dd137d53e | ||
|
|
8de06bd453 | ||
|
|
a7e64afc0d | ||
|
|
ed09887d9e | ||
|
|
d097d40237 | ||
|
|
196bbbd25b | ||
|
|
93e62c6f18 | ||
|
|
3acf03986a | ||
|
|
12a904eb4b | ||
|
|
7f06ec98b8 | ||
|
|
d62264c837 | ||
|
|
b2a67d458c | ||
|
|
de88fb2022 | ||
|
|
71263b5090 | ||
|
|
3fd1e4a992 | ||
|
|
9f752b8306 | ||
|
|
e07ae7631c | ||
|
|
9fd941f6fc | ||
|
|
91c458bf74 | ||
|
|
374b1144de | ||
|
|
f05b0871e9 | ||
|
|
4cb8fe3210 | ||
|
|
08eb5b42eb | ||
|
|
1c703e4161 | ||
|
|
ebd3723a06 | ||
|
|
06b23edb39 | ||
|
|
e893be3dec | ||
|
|
ca14942c80 | ||
|
|
11d01fcd32 | ||
|
|
5061607e77 | ||
|
|
69d8fe5b4f | ||
|
|
916efa4e1a | ||
|
|
a3492d69dd | ||
|
|
8e24c51233 | ||
|
|
d8107f77aa | ||
|
|
79e950b710 | ||
|
|
f0d7f3f1bd | ||
|
|
9afec53c55 | ||
|
|
11098d6eb0 | ||
|
|
7e6fc15ece | ||
|
|
78c0995853 | ||
|
|
84c14e623d | ||
|
|
d965d703d1 | ||
|
|
b20921d836 | ||
|
|
a78493f549 | ||
|
|
2be0aa9dbc | ||
|
|
aa29c68189 | ||
|
|
d3da30e8fb | ||
|
|
3337b5d3c4 | ||
|
|
458448357c | ||
|
|
27d0909302 | ||
|
|
5f0ebb71b2 | ||
|
|
00f647dc92 | ||
|
|
8e7202bd6a | ||
|
|
5cf7c827b8 | ||
|
|
71f7f4f543 | ||
|
|
bf47dba1c4 | ||
|
|
cbd457e557 | ||
|
|
6cf4b81558 | ||
|
|
bb84d351f1 | ||
|
|
a107e3cc84 | ||
|
|
e934966b54 | ||
|
|
bd9f23f1d2 | ||
|
|
2a2fb74ba8 | ||
|
|
bd819a5e81 | ||
|
|
162629571d | ||
|
|
2c04ad3c29 | ||
|
|
238d3807e9 | ||
|
|
7f9d227725 | ||
|
|
8de6e5a627 | ||
|
|
8d735cf6a9 | ||
|
|
29bb845f0e | ||
|
|
1bb2d59e38 | ||
|
|
3ceb2ad3cf | ||
|
|
009c803c8a | ||
|
|
c0ef1ec6fd | ||
|
|
69c2e8ce7e | ||
|
|
f102406cd7 | ||
|
|
302619a11a | ||
|
|
80bcae44e2 | ||
|
|
1f263a7683 | ||
|
|
3b57075109 | ||
|
|
3fa7304e94 | ||
|
|
47950b82a0 | ||
|
|
9ecf7070af | ||
|
|
2310773798 | ||
|
|
a60e3b5030 | ||
|
|
b350b443d0 | ||
|
|
2c517e4a33 | ||
|
|
4bdd59b4ad | ||
|
|
f5daf33322 | ||
|
|
1058a91b39 | ||
|
|
240b8f273a | ||
|
|
6808523d34 | ||
|
|
bad6184ab5 | ||
|
|
6b384287f3 | ||
|
|
ef33cf12ca | ||
|
|
a5cbbb8b5a | ||
|
|
71924fb7c0 | ||
|
|
b0565015cc | ||
|
|
fa283c6ecd | ||
|
|
94d157d97a | ||
|
|
f72f3dbc6a | ||
|
|
3c3a180417 | ||
|
|
fd6c854a21 | ||
|
|
e9cddc0be5 | ||
|
|
d7e5f11b78 | ||
|
|
2b1b6d8c2a | ||
|
|
acc2fa5816 | ||
|
|
6285f31604 | ||
|
|
3cca831b2e | ||
|
|
cff6fea32a | ||
|
|
17e1872544 | ||
|
|
246302375d | ||
|
|
231da4ff80 | ||
|
|
1b4b469440 | ||
|
|
35e3762e37 | ||
|
|
7e732dbd2d | ||
|
|
8b4d4ec25f | ||
|
|
035d0aeb31 | ||
|
|
f1bc181c5b | ||
|
|
50b724ca23 | ||
|
|
6227821b4e | ||
|
|
810056c2bc | ||
|
|
34b3e3a095 | ||
|
|
bdd085e9f1 | ||
|
|
ffc3503e6f | ||
|
|
51b16ad57d | ||
|
|
723592d923 | ||
|
|
22aa17091b | ||
|
|
4720a7d807 | ||
|
|
d5323223f4 | ||
|
|
fe79177b40 | ||
|
|
5c32ae15c2 | ||
|
|
6c2334f505 | ||
|
|
b55ac2afd6 | ||
|
|
d9012b4a64 | ||
|
|
952f124238 | ||
|
|
14db71d3fa | ||
|
|
f59ffcaeae | ||
|
|
d609e4a986 | ||
|
|
0e6c72ad1d | ||
|
|
d5f42201c5 | ||
|
|
122a0944a6 | ||
|
|
fa26ecc8f9 | ||
|
|
00139648a0 | ||
|
|
6ba38e9a38 | ||
|
|
812cb0ba77 | ||
|
|
b5c397435c | ||
|
|
043424824c | ||
|
|
c88c48a29f | ||
|
|
2fa93b291a | ||
|
|
1ad4d1aafd | ||
|
|
b108966b12 | ||
|
|
1fe8deeb6e | ||
|
|
fa4570bde8 | ||
|
|
f6c2787d80 | ||
|
|
4b8b625b90 | ||
|
|
be00d91967 | ||
|
|
e4a9905d6f | ||
|
|
68ec29e7ec | ||
|
|
d860ce0570 | ||
|
|
fc9b27c533 | ||
|
|
d4a9b546c1 | ||
|
|
628fb0fb72 | ||
|
|
2de233fe8b | ||
|
|
d2834b61fb | ||
|
|
c7f5ac22eb | ||
|
|
959df5cc14 | ||
|
|
e575494353 | ||
|
|
c0fb2c306d | ||
|
|
8418fed18e | ||
|
|
3de989b7bb | ||
|
|
5afda94a3c | ||
|
|
56dd4c0595 | ||
|
|
a9729eeb1b | ||
|
|
edb1843f24 | ||
|
|
e1960cadb2 | ||
|
|
32985f7904 | ||
|
|
e8e45fe2e3 | ||
|
|
6b7ddf1b03 | ||
|
|
b8c7622a8a | ||
|
|
983e509388 | ||
|
|
c9400d5c61 | ||
|
|
f967e90a96 | ||
|
|
38d4522ea5 | ||
|
|
c9ab75a44c | ||
|
|
8b47ca5f98 | ||
|
|
4e98c951e0 | ||
|
|
814424fa6e | ||
|
|
902f619a06 | ||
|
|
d66a98c2db | ||
|
|
e1b5593e07 | ||
|
|
789b8c8b49 | ||
|
|
795e3d5b6c | ||
|
|
73e9cac5c4 | ||
|
|
8010a0d90c | ||
|
|
3cb68ddb0d | ||
|
|
49f82f54b0 | ||
|
|
6bc7a71e55 | ||
|
|
2c1e590e47 | ||
|
|
84f7d28abf | ||
|
|
cb75737770 | ||
|
|
fb45ea139d | ||
|
|
bce0bbeda2 | ||
|
|
c6d934a685 | ||
|
|
143fde66bc | ||
|
|
4146c09a04 | ||
|
|
43f9c2d36e | ||
|
|
5e0813ca04 | ||
|
|
6ee9baa9c5 | ||
|
|
7c76ff3aaf | ||
|
|
deae1e7e29 | ||
|
|
4818a8e356 | ||
|
|
83aa63365a | ||
|
|
aed73be93d | ||
|
|
4ea62ecbcc | ||
|
|
60c8c90d35 | ||
|
|
c523b38abb | ||
|
|
f928b30caa | ||
|
|
20afed4058 | ||
|
|
a2224e380b | ||
|
|
31030baca3 | ||
|
|
173940cbdf | ||
|
|
6fc3590838 | ||
|
|
43f7a1fcd9 | ||
|
|
7faf272996 | ||
|
|
514a43f74b | ||
|
|
6655511ab8 | ||
|
|
168cfc2f6d | ||
|
|
6cfa0d502d | ||
|
|
a996dbb9d6 | ||
|
|
7572586ded | ||
|
|
a0ab9f2fdf | ||
|
|
1b50d55d0c | ||
|
|
7dc7f0d295 | ||
|
|
3f8da47a0c | ||
|
|
72fdd0bc09 | ||
|
|
be04a3b683 | ||
|
|
60f1fbe35b | ||
|
|
4531456be5 | ||
|
|
59ec393be1 | ||
|
|
306c0fea16 | ||
|
|
039019689a | ||
|
|
1eb896ae6f | ||
|
|
22338903bf | ||
|
|
baece5eeb3 | ||
|
|
b2846ea49d | ||
|
|
aa43b69651 | ||
|
|
6fe25548bd | ||
|
|
9002eaa259 | ||
|
|
2e3c541237 | ||
|
|
ead6d11ecf | ||
|
|
41e3e12f4b | ||
|
|
d4b202243a | ||
|
|
87250c4489 | ||
|
|
4a576af855 | ||
|
|
4fb6669196 | ||
|
|
9644399074 | ||
|
|
5b33a7a903 | ||
|
|
1fe0e30d71 | ||
|
|
75dd9e0fee | ||
|
|
23d7464306 | ||
|
|
32a5778602 | ||
|
|
b4493b4640 | ||
|
|
1c1eacfc94 | ||
|
|
aac2405e95 | ||
|
|
90765a7dac | ||
|
|
008337aad4 | ||
|
|
380e9b8119 | ||
|
|
ddfadae6f6 | ||
|
|
c8f46ce81d | ||
|
|
c30f4a9134 | ||
|
|
b7713d2d34 | ||
|
|
5b5bb070b9 | ||
|
|
feb664620a | ||
|
|
d2df2ad92d | ||
|
|
9e81b158bf | ||
|
|
49eb55c457 | ||
|
|
e6ba9e5849 | ||
|
|
a747cf994e | ||
|
|
afd0eb7f67 | ||
|
|
e4a6dd8c8c | ||
|
|
18c3024171 | ||
|
|
1e1368eea3 | ||
|
|
cda7616c82 | ||
|
|
015cea0c50 | ||
|
|
c0b5f5a8af | ||
|
|
f956f60f9f | ||
|
|
f893ec57cb | ||
|
|
9e24238cdd | ||
|
|
4dac6d45fd | ||
|
|
8d1a5731f3 | ||
|
|
04b3ce00e2 | ||
|
|
9386bfbafa | ||
|
|
a613e23e34 | ||
|
|
5ce1375ddd | ||
|
|
4cefd456bb | ||
|
|
bc911f4609 | ||
|
|
090920039f | ||
|
|
21a99397ff | ||
|
|
482fc9f51d | ||
|
|
b114ab7108 | ||
|
|
4cb4a3ac7f | ||
|
|
ee422110c8 | ||
|
|
e5ee4eba53 | ||
|
|
1e0b7dbdd2 | ||
|
|
5e152b7753 | ||
|
|
17f5b524a6 | ||
|
|
4ae16d7661 | ||
|
|
77d85cee52 | ||
|
|
d84dec47bf | ||
|
|
6c9170da51 | ||
|
|
2ce49ea0ee | ||
|
|
3db569c45a | ||
|
|
98985019f9 | ||
|
|
699cb5ed8f | ||
|
|
6005bd9833 | ||
|
|
ee494ab939 | ||
|
|
442780f214 | ||
|
|
9c47a8abfc | ||
|
|
dd5680dab6 | ||
|
|
1cdbc8e1aa | ||
|
|
e4168fdde5 | ||
|
|
4749e610af | ||
|
|
51d86370a5 | ||
|
|
d86c093480 | ||
|
|
bb7b9ef3fc | ||
|
|
5dd65a5c19 | ||
|
|
6eb97ca6cc | ||
|
|
9a822285eb | ||
|
|
c2716755f1 | ||
|
|
7087efaa79 | ||
|
|
921c2f6069 | ||
|
|
8ad98e8040 | ||
|
|
f7a10a9b9c | ||
|
|
bd621197f8 | ||
|
|
ec34da2d66 | ||
|
|
c2348ba768 | ||
|
|
75d69639e6 | ||
|
|
9485fd0c4d | ||
|
|
9b93b3a72c | ||
|
|
eaa2f899d5 | ||
|
|
1edf9c1ee4 | ||
|
|
45e9561b48 | ||
|
|
7de8bf6c27 | ||
|
|
1c2992e2e5 | ||
|
|
dc994699d9 | ||
|
|
a13f9f14d0 | ||
|
|
e71e2c74f8 | ||
|
|
7c4bd662cb | ||
|
|
6559fa7382 | ||
|
|
b9eea24728 | ||
|
|
8f33afead4 | ||
|
|
625c987d23 | ||
|
|
933479047f | ||
|
|
eef73d466d | ||
|
|
134d129986 | ||
|
|
4dffd3de66 | ||
|
|
cc8a929d43 | ||
|
|
1ab8220022 | ||
|
|
6e31f4bb19 | ||
|
|
9bda164ed3 | ||
|
|
c51889c157 | ||
|
|
b3c2febf79 | ||
|
|
96e66bb3e9 | ||
|
|
841326d713 | ||
|
|
7b6629802b | ||
|
|
c0bd660a9e | ||
|
|
0a8ef79dad | ||
|
|
b63399d606 | ||
|
|
273d028a82 | ||
|
|
2d94e71117 | ||
|
|
d918d0f0c3 | ||
|
|
517eff7e48 | ||
|
|
1f81865847 | ||
|
|
f3f1404849 | ||
|
|
24b7514fe0 | ||
|
|
91dc14c9fc | ||
|
|
32c2cafa89 | ||
|
|
74608531c7 | ||
|
|
48f85fbb09 | ||
|
|
535dfaf097 | ||
|
|
8f5ff379b7 | ||
|
|
b7260cafac | ||
|
|
3d27751b69 | ||
|
|
4053fe0a9b | ||
|
|
e75856a7d2 | ||
|
|
50380f8c14 | ||
|
|
4032af0b78 | ||
|
|
2bb55f017d | ||
|
|
1287b307ac | ||
|
|
24618305cc | ||
|
|
4ec5050cbb | ||
|
|
eccbcb73a1 | ||
|
|
e781e1cf1d | ||
|
|
e9a21c1dc6 | ||
|
|
a37ed45534 | ||
|
|
26484d0c7b | ||
|
|
68db75b4e3 | ||
|
|
9048eb676b | ||
|
|
6a5b022939 | ||
|
|
57a24b2cdf | ||
|
|
da47389483 | ||
|
|
4c329110c5 | ||
|
|
46fbae0d71 | ||
|
|
1835e988cf | ||
|
|
537347d9b5 | ||
|
|
811dbfa52d | ||
|
|
ba35ca522a | ||
|
|
c6a1f2e2f3 | ||
|
|
604c27f001 | ||
|
|
0535490618 | ||
|
|
9c0fc4930b | ||
|
|
a45f2cb205 | ||
|
|
3fd5b5975a | ||
|
|
9175f0b6af | ||
|
|
1160d03279 | ||
|
|
789e0df49e | ||
|
|
83bbf21f1a | ||
|
|
7a8054d678 | ||
|
|
c0bbb7254d | ||
|
|
4f1f03cdb9 | ||
|
|
382c766983 | ||
|
|
f5f6e9cf37 | ||
|
|
cf88b33383 | ||
|
|
57615edd3a | ||
|
|
49cb88d158 | ||
|
|
1464d84cf5 | ||
|
|
74ce027924 | ||
|
|
39f698886a | ||
|
|
9f8f2bc874 | ||
|
|
f8daadc5ef | ||
|
|
f2371db2a9 | ||
|
|
7d1775e000 | ||
|
|
ce4a7f16ca | ||
|
|
322eca86bc | ||
|
|
3d06e6083a | ||
|
|
b64006221c | ||
|
|
1fde872016 | ||
|
|
2701eabe39 | ||
|
|
c388101217 | ||
|
|
1528d1ca83 | ||
|
|
0bbad683c5 | ||
|
|
9ec435d863 | ||
|
|
9b1c4b2dd6 | ||
|
|
7196971159 | ||
|
|
eb1669a061 | ||
|
|
c34aa72538 | ||
|
|
da883d6196 | ||
|
|
b482df04ec | ||
|
|
5fcb5ae549 | ||
|
|
a0d484113a | ||
|
|
d9c87559b5 | ||
|
|
1547d3b656 | ||
|
|
ea29ad6f96 | ||
|
|
1a95e48389 | ||
|
|
ac2fe4e04f | ||
|
|
cfdd3a853d | ||
|
|
01e40e62bf | ||
|
|
35f9eae6c3 | ||
|
|
fe565e17c3 | ||
|
|
4735a7f9b5 | ||
|
|
54f8860612 | ||
|
|
ed172c06e0 | ||
|
|
adbe9e2e1c | ||
|
|
2c3a6a6fa9 | ||
|
|
61551b0591 | ||
|
|
280d580ae2 | ||
|
|
782a1bf7b0 | ||
|
|
3191778d33 | ||
|
|
9bfa633187 | ||
|
|
9209dcfa26 | ||
|
|
919b40c6cf | ||
|
|
10b03eee27 | ||
|
|
0b50f9e02c | ||
|
|
f05a32509e | ||
|
|
e4f2e4a203 | ||
|
|
6ba56befad | ||
|
|
15c8b85a4b | ||
|
|
c6db567e3f | ||
|
|
4952f86682 | ||
|
|
16b7cc7655 | ||
|
|
99fab793c0 | ||
|
|
9423767827 | ||
|
|
e966df3fed | ||
|
|
3aafa21887 | ||
|
|
9a490f9e01 | ||
|
|
0a24261afb | ||
|
|
8b7bf8691d | ||
|
|
d3a6e2a991 | ||
|
|
171cd0dfe1 | ||
|
|
4d7e802c44 | ||
|
|
109a120b39 | ||
|
|
f53008d916 | ||
|
|
34c1056efc | ||
|
|
00e7a76ecc | ||
|
|
e689d499e7 | ||
|
|
5df9bdec9a | ||
|
|
c722851f92 | ||
|
|
877f3f61a0 | ||
|
|
1dd4c52a8b | ||
|
|
c6e1696f07 | ||
|
|
1483e15e4e | ||
|
|
6a56d5b87b | ||
|
|
289aee9448 | ||
|
|
0e9236475b | ||
|
|
181480b68b | ||
|
|
61e66e936f | ||
|
|
314182e7e0 | ||
|
|
69e6e9e5c7 | ||
|
|
fc347ba60f | ||
|
|
26eb859663 | ||
|
|
338ad42273 | ||
|
|
5722ccfcda | ||
|
|
0237b0d972 | ||
|
|
a850041cf0 | ||
|
|
5071f28d55 | ||
|
|
e0361b1f9f | ||
|
|
f319354174 | ||
|
|
a73c4bd5a7 | ||
|
|
d79c85af62 | ||
|
|
407819e5a9 | ||
|
|
2c15597e24 | ||
|
|
a17b6bbb64 | ||
|
|
1922a4272c | ||
|
|
2b10791df2 | ||
|
|
1ad5c3813c | ||
|
|
7d5f8214cf | ||
|
|
2b0b44c5ce | ||
|
|
f7c9091970 | ||
|
|
7b1e8fdd06 | ||
|
|
d257dedf42 | ||
|
|
3d2a714b5a | ||
|
|
de933a1d48 | ||
|
|
566a15285a | ||
|
|
43cf95e3c6 | ||
|
|
0b12ceabe9 | ||
|
|
e96f28c536 | ||
|
|
d5e36bd2f0 | ||
|
|
34e8f63f77 | ||
|
|
3e422c8776 | ||
|
|
edfb31f4fe | ||
|
|
8562a1bb2f | ||
|
|
fa7192fdfb | ||
|
|
c22c0f2706 | ||
|
|
5736742c3e | ||
|
|
248f991ad4 | ||
|
|
55f10eb1c1 | ||
|
|
d0ca118387 | ||
|
|
69a9adc4c3 | ||
|
|
e2445f4c97 | ||
|
|
ed2a4ba1d5 | ||
|
|
6d1552af51 | ||
|
|
c969de7fad | ||
|
|
b8c300e61e | ||
|
|
2499bbb09d | ||
|
|
7c70d5c1bd | ||
|
|
f90381910b | ||
|
|
172c31ff45 | ||
|
|
bbfd1dd0c0 | ||
|
|
8d71e5d698 | ||
|
|
0f69169262 | ||
|
|
72bcebbfb1 | ||
|
|
0fde09a866 | ||
|
|
e7bf936d2b | ||
|
|
3d7f72311a | ||
|
|
6a548336ec | ||
|
|
d3e7766f89 | ||
|
|
360193320f | ||
|
|
1f1b8e16a7 | ||
|
|
3abff7928c | ||
|
|
2976df2dc6 | ||
|
|
f49cb62812 | ||
|
|
55d9c5f80c | ||
|
|
d1ca986f55 | ||
|
|
3ac1d0e4d1 | ||
|
|
0e66a66bce | ||
|
|
43a23f91a6 | ||
|
|
8d229bfd21 | ||
|
|
04cd318f6c | ||
|
|
141d400b4a | ||
|
|
b841eb4c54 | ||
|
|
4f6bc754b8 | ||
|
|
26697a0223 | ||
|
|
480054bc3a | ||
|
|
538e5878a1 | ||
|
|
9cb4e14327 | ||
|
|
da71da23d9 | ||
|
|
0d5731383f | ||
|
|
4fd7676e92 | ||
|
|
8209bb309b | ||
|
|
d4b873ca76 | ||
|
|
5b601f00b1 | ||
|
|
2c95772a6a | ||
|
|
867fc5bd4b | ||
|
|
567de35df4 | ||
|
|
34bf70faea | ||
|
|
6b9c8ffd14 | ||
|
|
96061d2a2f | ||
|
|
88b167cc10 | ||
|
|
a79fba13e1 | ||
|
|
a1440c819b | ||
|
|
6edb7e02d0 | ||
|
|
c79dcbd7c4 | ||
|
|
acba82c8f7 | ||
|
|
1f9aea9905 | ||
|
|
742d69bf4d | ||
|
|
5776b8f01c | ||
|
|
6c54d3fa82 | ||
|
|
2e6eee991d | ||
|
|
c59b12c939 | ||
|
|
0222b1701e | ||
|
|
43e2c9837e | ||
|
|
c4fc7b52ae | ||
|
|
cd948b56ac | ||
|
|
19a713970f | ||
|
|
4484a3ea0d | ||
|
|
ea41a1045f | ||
|
|
005c13ff05 | ||
|
|
1569176e48 | ||
|
|
7c3d227527 | ||
|
|
0f92f6319f | ||
|
|
7b9f2fa9ef | ||
|
|
8de8ca05f1 | ||
|
|
18d7f7f835 | ||
|
|
73e085ae23 | ||
|
|
af960b9b40 | ||
|
|
d09e6d5b0f | ||
|
|
db41102bfa | ||
|
|
1fc0d78913 | ||
|
|
f3f84b1544 | ||
|
|
60a34087c9 | ||
|
|
266bc05edc | ||
|
|
51aff3ca57 | ||
|
|
30cf002574 | ||
|
|
89a77ab2f9 | ||
|
|
484331cd8d | ||
|
|
181963ba08 | ||
|
|
50c2f2e87f | ||
|
|
ba8e6035b0 | ||
|
|
81ec7337e0 | ||
|
|
ed9470b19d | ||
|
|
fccde030d5 | ||
|
|
fc0f5d8f72 | ||
|
|
34af39667b | ||
|
|
6ffd7da4d7 | ||
|
|
5958dc920b | ||
|
|
5a45d95b80 | ||
|
|
23aeca85ff | ||
|
|
b5976474dd | ||
|
|
18478e2d3d | ||
|
|
ca5c0bf78e | ||
|
|
4cc9d946de | ||
|
|
50fd8f6f44 | ||
|
|
7711fcda69 | ||
|
|
7717ea5cca | ||
|
|
ae46674cd3 | ||
|
|
00e05ae3c9 | ||
|
|
4bc81c2bd2 | ||
|
|
74cd134b54 | ||
|
|
734ae7fcb8 | ||
|
|
7b8e42a763 | ||
|
|
566fb22bcf | ||
|
|
b88ccb4f1b | ||
|
|
efbce9f0fa | ||
|
|
88849c06a6 | ||
|
|
5d617edbbf | ||
|
|
6aed9f268b | ||
|
|
9074c923ea | ||
|
|
1365495599 | ||
|
|
461d54e43c | ||
|
|
96ecc26507 | ||
|
|
91e1929b52 | ||
|
|
04614c7527 | ||
|
|
f7ff5b766c | ||
|
|
d9f9b77d68 | ||
|
|
4b1a2caea7 | ||
|
|
af0d6f58b9 | ||
|
|
2710d6399a | ||
|
|
650eab6a0e | ||
|
|
5de36dfdf0 | ||
|
|
1dd731fdb8 | ||
|
|
6fa4be5af2 | ||
|
|
941b7025b6 | ||
|
|
4b2a4b03ec | ||
|
|
7ab9915859 | ||
|
|
86fcd170f6 | ||
|
|
64fa89d406 | ||
|
|
eb73182fcf | ||
|
|
356bb62243 | ||
|
|
de2c20be84 | ||
|
|
96f2165067 | ||
|
|
7944e8e323 | ||
|
|
5c39abfe53 | ||
|
|
1020e9c3af | ||
|
|
cc7acba02b | ||
|
|
f188cf81dc | ||
|
|
7db2369081 | ||
|
|
db85ab8aa0 | ||
|
|
86c8328f62 | ||
|
|
72fcd00859 | ||
|
|
8a7873ee3a | ||
|
|
e738d35c4e | ||
|
|
6ddda5fc5e | ||
|
|
7291342723 | ||
|
|
70a6233b94 | ||
|
|
749ca28534 | ||
|
|
321c2e6a47 | ||
|
|
7b11660f4f | ||
|
|
4fb46faae7 | ||
|
|
316f6ed313 | ||
|
|
108d28316a | ||
|
|
5c46dc41de | ||
|
|
d42ff509ba | ||
|
|
2cb0fbf589 | ||
|
|
a0bad1695c | ||
|
|
681d7851aa | ||
|
|
3063ad1d05 | ||
|
|
76b1f017c0 | ||
|
|
c765688779 | ||
|
|
d4686ebcc5 | ||
|
|
f653aca0ed | ||
|
|
0a457eafed | ||
|
|
b211f834fa | ||
|
|
9aefc2b7a6 | ||
|
|
10f0d7ccac | ||
|
|
cb460b7dec | ||
|
|
39a82d951b | ||
|
|
a54f9715b1 | ||
|
|
4c47c2b2c9 | ||
|
|
ccb2f00b8a | ||
|
|
3bf447b422 | ||
|
|
10cd672a92 | ||
|
|
f3c64d0740 | ||
|
|
dca200c2e9 | ||
|
|
b188217e83 | ||
|
|
3a50c2bbfb | ||
|
|
e0e9cd8680 | ||
|
|
b6872fb454 | ||
|
|
3f3cca8f2a | ||
|
|
647ee5b74a |
27
.github/ISSUE_TEMPLATE.md
vendored
Normal file
27
.github/ISSUE_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<!--
|
||||
|
||||
Welcome! If you have a question or are unsure if you should open an issue,
|
||||
please use the forum instead!
|
||||
|
||||
https://forum.restic.net
|
||||
|
||||
The forum is a better place for questions about restic or general suggestions
|
||||
and topics, e.g. usage or documentation questions! This issue tracker is mainly
|
||||
for tracking bugs and feature requests directly relating to the development of
|
||||
the software itself, rather than the project.
|
||||
|
||||
Thanks for understanding, and for contributing to the project!
|
||||
-->
|
||||
|
||||
|
||||
Output of `restic version`
|
||||
--------------------------
|
||||
|
||||
<!--
|
||||
Please add the version of restic you're currently using here, this helps us
|
||||
later to see what has changed in restic when we revisit this issue after some
|
||||
time.
|
||||
-->
|
||||
|
||||
Describe the issue
|
||||
------------------
|
||||
93
.github/ISSUE_TEMPLATE/Bug.md
vendored
Normal file
93
.github/ISSUE_TEMPLATE/Bug.md
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Report a problem with restic to help us resolve it and improve
|
||||
---
|
||||
|
||||
<!--
|
||||
|
||||
Welcome! - We kindly ask that you:
|
||||
|
||||
1. Fill out the issue template below - not doing so needs a good reason.
|
||||
2. Use the forum if you have a question rather than a bug or feature request.
|
||||
|
||||
The forum is at: https://forum.restic.net
|
||||
|
||||
NOTE: Not filling out the issue template needs a good reason, as otherwise it
|
||||
may take a lot longer to find the problem, not to mention it can take up a lot
|
||||
more time which can otherwise be spent on development. Please also take the
|
||||
time to help us debug the issue by collecting relevant information, even if
|
||||
it doesn't seem to be relevant to you. Thanks!
|
||||
|
||||
The forum is a better place for questions about restic or general suggestions
|
||||
and topics, e.g. usage or documentation questions! This issue tracker is mainly
|
||||
for tracking bugs and feature requests directly relating to the development of
|
||||
the software itself, rather than the project.
|
||||
|
||||
Thanks for understanding, and for contributing to the project!
|
||||
|
||||
-->
|
||||
|
||||
|
||||
Output of `restic version`
|
||||
--------------------------
|
||||
|
||||
|
||||
How did you run restic exactly?
|
||||
-------------------------------
|
||||
|
||||
<!--
|
||||
This section should include at least:
|
||||
|
||||
* The complete command line and any environment variables you used to
|
||||
configure restic's backend access. Make sure to replace sensitive values!
|
||||
|
||||
* The output of the commands, what restic prints gives may give us much
|
||||
information to diagnose the problem!
|
||||
-->
|
||||
|
||||
What backend/server/service did you use to store the repository?
|
||||
----------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
Expected behavior
|
||||
-----------------
|
||||
|
||||
<!--
|
||||
Describe what you'd like restic to do differently.
|
||||
-->
|
||||
|
||||
Actual behavior
|
||||
---------------
|
||||
|
||||
<!--
|
||||
In this section, please try to concentrate on observations, so only describe
|
||||
what you observed directly.
|
||||
-->
|
||||
|
||||
Steps to reproduce the behavior
|
||||
-------------------------------
|
||||
|
||||
<!--
|
||||
The more time you spend describing an easy way to reproduce the behavior (if
|
||||
this is possible), the easier it is for the project developers to fix it!
|
||||
-->
|
||||
|
||||
Do you have any idea what may have caused this?
|
||||
-----------------------------------------------
|
||||
|
||||
|
||||
|
||||
Do you have an idea how to solve the issue?
|
||||
-------------------------------------------
|
||||
|
||||
|
||||
|
||||
Did restic help you or made you happy in any way?
|
||||
-------------------------------------------------
|
||||
|
||||
<!--
|
||||
Answering this question is not required, but if you have anything positive to share, please do so here!
|
||||
Sometimes we get tired of reading bug reports all day and a little positive end note does wonders.
|
||||
Idea by Joey Hess, https://joeyh.name/blog/entry/two_holiday_stories/
|
||||
-->
|
||||
57
.github/ISSUE_TEMPLATE/Feature.md
vendored
Normal file
57
.github/ISSUE_TEMPLATE/Feature.md
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest a new feature or enhancement for restic
|
||||
---
|
||||
|
||||
<!--
|
||||
|
||||
Welcome! - We kindly ask that you:
|
||||
|
||||
1. Fill out the issue template below - not doing so needs a good reason.
|
||||
2. Use the forum if you have a question rather than a bug or feature request.
|
||||
|
||||
The forum is at: https://forum.restic.net
|
||||
|
||||
The forum is a better place for questions about restic or general suggestions
|
||||
and topics, e.g. usage or documentation questions! This issue tracker is mainly
|
||||
for tracking bugs and feature requests directly relating to the development of
|
||||
the software itself, rather than the project.
|
||||
|
||||
Thanks for understanding, and for contributing to the project!
|
||||
|
||||
-->
|
||||
|
||||
|
||||
Output of `restic version`
|
||||
--------------------------
|
||||
|
||||
<!--
|
||||
Please add the version of restic you're currently using here, this helps us
|
||||
later to see what has changed in restic when we revisit this issue after some
|
||||
time.
|
||||
-->
|
||||
|
||||
What should restic do differently? Which functionality do you think we should add?
|
||||
----------------------------------------------------------------------------------
|
||||
|
||||
<!--
|
||||
Please describe the feature you'd like us to add here.
|
||||
-->
|
||||
|
||||
|
||||
What are you trying to do?
|
||||
--------------------------
|
||||
|
||||
<!--
|
||||
This section should contain a brief description what you're trying to do, which
|
||||
would be possible after implementing the new feature.
|
||||
-->
|
||||
|
||||
Did restic help you or made you happy in any way?
|
||||
-------------------------------------------------
|
||||
|
||||
<!--
|
||||
Answering this question is not required, but if you have anything positive to share, please do so here!
|
||||
Sometimes we get tired of reading bug reports all day and a little positive end note does wonders.
|
||||
Idea by Joey Hess, https://joeyh.name/blog/entry/two_holiday_stories/
|
||||
-->
|
||||
36
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
36
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
|
||||
|
||||
<!--
|
||||
Thank you very much for contributing code or documentation to restic! Please
|
||||
fill out the following questions to make it easier for us to review your
|
||||
changes.
|
||||
|
||||
You do not need to check all the boxes below all at once, feel free to take
|
||||
your time and add more commits. If you're done and ready for review, please
|
||||
check the last box.
|
||||
-->
|
||||
|
||||
What is the purpose of this change? What does it change?
|
||||
--------------------------------------------------------
|
||||
|
||||
<!--
|
||||
Describe the changes here, as detailed as needed.
|
||||
-->
|
||||
|
||||
Was the change discussed in an issue or in the forum before?
|
||||
------------------------------------------------------------
|
||||
|
||||
<!--
|
||||
Link issues and relevant forum posts here.
|
||||
-->
|
||||
|
||||
Checklist
|
||||
---------
|
||||
|
||||
- [ ] I have read the [Contribution Guidelines](https://github.com/restic/restic/blob/master/CONTRIBUTING.md#providing-patches)
|
||||
- [ ] I have added tests for all changes in this PR
|
||||
- [ ] I have added documentation for the changes (in the manual)
|
||||
- [ ] There's a new file in `changelog/unreleased/` that describes the changes for our users (template [here](https://github.com/restic/restic/blob/master/changelog/TEMPLATE))
|
||||
- [ ] I have run `gofmt` on the code in all commits
|
||||
- [ ] All commit messages are formatted in the same style as [the other commits in the repo](https://github.com/restic/restic/blob/master/CONTRIBUTING.md#git-commits)
|
||||
- [ ] I'm done, this Pull Request is ready for review
|
||||
6
.gitignore
vendored
6
.gitignore
vendored
@@ -1,8 +1,2 @@
|
||||
/.gopath
|
||||
/restic
|
||||
/restic.debug
|
||||
/dirdiff
|
||||
cmd/dirdiff/dirdiff
|
||||
cmd/gentestdata/gentestdata
|
||||
cmd/restic/restic
|
||||
/.vagrant
|
||||
|
||||
2
.hound.yml
Normal file
2
.hound.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
go:
|
||||
enabled: true
|
||||
47
.travis.yml
47
.travis.yml
@@ -1,14 +1,44 @@
|
||||
language: go
|
||||
sudo: false
|
||||
|
||||
go:
|
||||
- 1.3.3
|
||||
- 1.4.2
|
||||
- 1.5
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
go: "1.9.x"
|
||||
env: RESTIC_TEST_FUSE=0 RESTIC_TEST_CLOUD_BACKENDS=0 RESTIC_BUILD_SOLARIS=0
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.cache/go-build
|
||||
- $HOME/gopath/pkg/mod
|
||||
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
- os: linux
|
||||
go: "1.10.x"
|
||||
env: RESTIC_TEST_FUSE=0 RESTIC_TEST_CLOUD_BACKENDS=0
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.cache/go-build
|
||||
- $HOME/gopath/pkg/mod
|
||||
|
||||
# only run fuse and cloud backends tests on Travis for the latest Go on Linux
|
||||
- os: linux
|
||||
go: "1.11.x"
|
||||
sudo: true
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.cache/go-build
|
||||
- $HOME/gopath/pkg/mod
|
||||
|
||||
- os: osx
|
||||
go: "1.11.x"
|
||||
env: RESTIC_TEST_FUSE=0 RESTIC_TEST_CLOUD_BACKENDS=0
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/Library/Caches/go-build
|
||||
- $HOME/gopath/pkg/mod
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
||||
notifications:
|
||||
irc:
|
||||
@@ -22,11 +52,10 @@ install:
|
||||
- go version
|
||||
- export GOBIN="$GOPATH/bin"
|
||||
- export PATH="$PATH:$GOBIN"
|
||||
- export GOPATH="$GOPATH:${TRAVIS_BUILD_DIR}/Godeps/_workspace"
|
||||
- go env
|
||||
|
||||
script:
|
||||
- go run run_integration_tests.go
|
||||
|
||||
after_success:
|
||||
- goveralls -coverprofile=all.cov -service=travis-ci -repotoken "$COVERALLS_TOKEN" || true
|
||||
- test -r all.cov && bash <(curl -s https://codecov.io/bash) -f all.cov
|
||||
|
||||
1701
CHANGELOG.md
Normal file
1701
CHANGELOG.md
Normal file
File diff suppressed because it is too large
Load Diff
158
CONTRIBUTING.md
158
CONTRIBUTING.md
@@ -3,7 +3,10 @@ This document describes the way you can contribute to the restic project.
|
||||
Ways to Help Out
|
||||
================
|
||||
|
||||
Thank you for your contribution!
|
||||
Thank you for your contribution! Please **open an issue first** (or add a
|
||||
comment to an existing issue) if you plan to work on any code or add a new
|
||||
feature. This way, duplicate work is prevented and we can discuss your ideas
|
||||
and design first.
|
||||
|
||||
There are several ways you can help us out. First of all code contributions and
|
||||
bug fixes are most welcome. However even "minor" details as fixing spelling
|
||||
@@ -25,50 +28,93 @@ those tagged
|
||||
[minor complexity](https://github.com/restic/restic/labels/minor%20complexity).
|
||||
|
||||
|
||||
Reporting Bugs
|
||||
==============
|
||||
|
||||
You've found a bug? Thanks for letting us know so we can fix it! It is a good
|
||||
idea to describe in detail how to reproduce the bug (when you know how), what
|
||||
environment was used and so on. Please tell us at least the following things:
|
||||
|
||||
* What's the version of restic you used? Please include the output of
|
||||
`restic version` in your bug report.
|
||||
* What commands did you execute to get to where the bug occurred?
|
||||
* What did you expect?
|
||||
* What happened instead?
|
||||
* Are you aware of a way to reproduce the bug?
|
||||
|
||||
Remember, the easier it is for us to reproduce the bug, the earlier it will be
|
||||
corrected!
|
||||
|
||||
In addition, you can compile restic with debug support by running
|
||||
`go run -mod=vendor build.go -tags debug` and instructing it to create a debug
|
||||
log by setting the environment variable `DEBUG_LOG` to a file, e.g. like this:
|
||||
|
||||
$ export DEBUG_LOG=/tmp/restic-debug.log
|
||||
$ restic backup ~/work
|
||||
|
||||
For Go < 1.11, you need to remove the `-mod=vendor` option from the build
|
||||
command.
|
||||
|
||||
Please be aware that the debug log file will contain potentially sensitive
|
||||
things like file and directory names, so please either redact it before
|
||||
uploading it somewhere or post only the parts that are really relevant.
|
||||
|
||||
|
||||
Development Environment
|
||||
=======================
|
||||
|
||||
For development, it is recommended to check out the restic repository within a
|
||||
`GOPATH`, an introductory text is
|
||||
["How to Write Go Code"](https://golang.org/doc/code.html). It is recommended
|
||||
to have a working directory, we're using `~/work/restic` in the following. This
|
||||
directory mainly contains the directory `src`, where the source code is stored.
|
||||
The repository contains several sets of directories with code: `cmd/` and
|
||||
`internal/` contain the code written for restic, whereas `vendor/` contains
|
||||
copies of libraries restic depends on. The libraries are managed with the
|
||||
command `go mod vendor`.
|
||||
|
||||
First, create the necessary directory structure and clone the restic repository
|
||||
to the correct location:
|
||||
Go >= 1.11
|
||||
----------
|
||||
|
||||
$ mkdir --parents ~/work/restic/src/github.com/restic
|
||||
$ cd ~/work/restic/src/github.com/restic
|
||||
For Go version 1.11 or later, you should clone the repo (without having
|
||||
`$GOPATH` set) and `cd` into the directory:
|
||||
|
||||
$ unset GOPATH
|
||||
$ git clone https://github.com/restic/restic
|
||||
$ cd restic
|
||||
|
||||
Now we're in the main directory of the restic repository. The last step is to
|
||||
set the environment variable `$GOPATH` to the correct value:
|
||||
Then use the `go` tool to build restic:
|
||||
|
||||
$ export GOPATH=~/work/restic:~/work/restic/src/github.com/restic/restic/Godeps/_workspace
|
||||
$ go build ./cmd/restic
|
||||
$ ./restic version
|
||||
restic 0.9.2-dev (compiled manually) compiled with go1.11 on linux/amd64
|
||||
|
||||
You can run all tests with the following command:
|
||||
|
||||
$ go test ./...
|
||||
|
||||
Go < 1.11
|
||||
---------
|
||||
|
||||
In order to compile restic with Go before 1.11, it needs to be checked out at
|
||||
the right path within a `GOPATH`. The concept of a `GOPATH` is explained in
|
||||
["How to write Go code"](https://golang.org/doc/code.html).
|
||||
|
||||
If you do not have a directory with Go code yet, executing the following
|
||||
instructions in your shell will create one for you and check out the restic
|
||||
repo:
|
||||
|
||||
$ export GOPATH="$HOME/go"
|
||||
$ mkdir -p "$GOPATH/src/github.com/restic"
|
||||
$ cd "$GOPATH/src/github.com/restic"
|
||||
$ git clone https://github.com/restic/restic
|
||||
$ cd restic
|
||||
|
||||
You can then build restic as follows:
|
||||
|
||||
$ go build ./cmd/restic
|
||||
$ ./restic version
|
||||
restic compiled manually
|
||||
compiled with go1.8.3 on linux/amd64
|
||||
|
||||
The following commands can be used to run all the tests:
|
||||
|
||||
$ go test ./...
|
||||
ok github.com/restic/restic 8.174s
|
||||
[...]
|
||||
|
||||
The restic binary can be built from the directory `cmd/restic` this way:
|
||||
|
||||
$ cd cmd/restic
|
||||
$ go build
|
||||
$ ./restic version
|
||||
restic compiled manually on go1.4.2
|
||||
|
||||
if you want to run your tests on Linux, OpenBSD or FreeBSD, you can use
|
||||
[vagrant](https://www.vagrantup.com/) with the proveded `Vagrantfile` to
|
||||
quickly set up VMs and run the tests, e.g.:
|
||||
|
||||
$ vagrant up freebsd
|
||||
[...]
|
||||
|
||||
$ vagrant ssh freebsd -c 'cd restic/restic; go test -v ./...'
|
||||
[...]
|
||||
|
||||
Providing Patches
|
||||
=================
|
||||
@@ -78,23 +124,40 @@ get it into the project! The workflow we're using is also described on the
|
||||
[GitHub Flow](https://guides.github.com/introduction/flow/) website, it boils
|
||||
down to the following steps:
|
||||
|
||||
0. If you want to work on something, please add a comment to the issue on
|
||||
GitHub. For a new feature, please add an issue before starting to work on
|
||||
it, so that duplicate work is prevented.
|
||||
|
||||
1. First we would kindly ask you to fork our project on GitHub if you haven't
|
||||
done so already.
|
||||
|
||||
2. Clone the repository locally and create a new branch. If you are working on
|
||||
the code itself, please set up the development environment as described in
|
||||
the previous section and instead of cloning add your fork on GitHub as a
|
||||
remote to the clone of the restic repository.
|
||||
the previous section. Especially take care to place your forked repository
|
||||
at the correct path (`src/github.com/restic/restic`) within your `GOPATH`.
|
||||
|
||||
3. Then commit your changes as fine grained as possible, as smaller patches,
|
||||
that handle one and only one issue are easier to discuss and merge.
|
||||
|
||||
4. Push the new branch with your changes to your fork of the repository.
|
||||
|
||||
5. Create a pull request by visiting the GitHub website, it will guide you
|
||||
through the process.
|
||||
|
||||
6. You will receive comments on your code and the feature or bug that they
|
||||
address. Maybe you need to rework some minor things, in this case push new
|
||||
commits to the branch you created for the pull request, they will be
|
||||
commits to the branch you created for the pull request (or amend the
|
||||
existing commit, use common sense to decide which is better), they will be
|
||||
automatically added to the pull request.
|
||||
7. Once your code looks good, we'll merge it. Thanks a low for your
|
||||
contribution!
|
||||
|
||||
7. If your pull request changes anything that users should be aware of (a
|
||||
bugfix, a new feature, ...) please add an entry to the file
|
||||
['CHANGELOG.md'](CHANGELOG.md). It will be used in the announcement of the
|
||||
next stable release. While writing, ask yourself: If I were the user, what
|
||||
would I need to be aware of with this change.
|
||||
|
||||
8. Once your code looks good and passes all the tests, we'll merge it. Thanks
|
||||
a lot for your contribution!
|
||||
|
||||
Please provide the patches for each bug or feature in a separate branch and
|
||||
open up a pull request for each.
|
||||
@@ -104,22 +167,31 @@ run
|
||||
|
||||
gofmt -w **/*.go
|
||||
|
||||
in the project root directory before committing. Installing the script
|
||||
`fmt-check` from https://github.com/edsrzf/gofmt-git-hook locally as a
|
||||
pre-commit hook checks formatting before committing automatically, just copy
|
||||
this script to `.git/hooks/pre-commit`.
|
||||
in the project root directory before committing. For each Pull Request, the
|
||||
formatting is tested with `gofmt` for the latest stable version of Go.
|
||||
Installing the script `fmt-check` from https://github.com/edsrzf/gofmt-git-hook
|
||||
locally as a pre-commit hook checks formatting before committing automatically,
|
||||
just copy this script to `.git/hooks/pre-commit`.
|
||||
|
||||
For each pull request, several different systems run the integration tests on
|
||||
Linux, macOS and Windows. We won't merge any code that does not pass all tests
|
||||
for all systems, so when a tests fails, try to find out what's wrong and fix
|
||||
it. If you need help on this, please leave a comment in the pull request, and
|
||||
we'll be glad to assist. Having a PR with failing integration tests is nothing
|
||||
to be ashamed of. In contrast, that happens regularly for all of us. That's
|
||||
what the tests are there for.
|
||||
|
||||
Git Commits
|
||||
-----------
|
||||
|
||||
I would be good if you could follow the same general style regarding Git
|
||||
It would be good if you could follow the same general style regarding Git
|
||||
commits as the rest of the project, this makes reviewing code, browsing the
|
||||
history and triaging bugs much easier.
|
||||
|
||||
Git commit messages have a very terse summary in the first line of the commit
|
||||
message, followed by an empty line, followed by a more verbose description or a
|
||||
List of changed things. For examples, please refer to the excellent [How to
|
||||
Write a Git Commit Message](http://chris.beams.io/posts/git-commit/).
|
||||
Write a Git Commit Message](https://chris.beams.io/posts/git-commit/).
|
||||
|
||||
If you change/add multiple different things that aren't related at all, try to
|
||||
make several smaller commits. This is much easier to review. Using `git add -p`
|
||||
|
||||
27
GOVERNANCE.md
Normal file
27
GOVERNANCE.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# restic project governance
|
||||
|
||||
## Overview
|
||||
|
||||
The restic project uses a governance model commonly described as Benevolent
|
||||
Dictator For Life (BDFL). This document outlines our understanding of what this
|
||||
means. It is derived from the [i3 window manager project
|
||||
governance](https://raw.githubusercontent.com/i3/i3/next/.github/GOVERNANCE.md).
|
||||
|
||||
## Roles
|
||||
|
||||
* user: anyone who interacts with the restic project
|
||||
* core contributor: a handful of people who have contributed significantly to
|
||||
the project by any means (issue triage, support, documentation, code, etc.).
|
||||
Core contributors are recognizable via GitHub’s "Member" badge.
|
||||
* Benevolent Dictator For Life (BDFL): a single individual who makes decisions
|
||||
when consensus cannot be reached. restic's current BDFL is [@fd0](https://github.com/fd0).
|
||||
|
||||
## Decision making process
|
||||
|
||||
In general, we try to reach consensus in discussions. In case consensus cannot
|
||||
be reached, the BDFL makes a decision.
|
||||
|
||||
## Contribution process
|
||||
|
||||
The contribution process is described in a separate document called
|
||||
[CONTRIBUTING](CONTRIBUTING.md).
|
||||
62
Godeps/Godeps.json
generated
62
Godeps/Godeps.json
generated
@@ -1,62 +0,0 @@
|
||||
{
|
||||
"ImportPath": "github.com/restic/restic",
|
||||
"GoVersion": "go1.4.2",
|
||||
"Packages": [
|
||||
"./..."
|
||||
],
|
||||
"Deps": [
|
||||
{
|
||||
"ImportPath": "bazil.org/fuse",
|
||||
"Rev": "18419ee53958df28fcfc9490fe6123bd59e237bb"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/jessevdk/go-flags",
|
||||
"Comment": "v1-297-g1b89bf7",
|
||||
"Rev": "1b89bf73cd2c3a911d7b2a279ab085c4a18cf539"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/juju/errors",
|
||||
"Rev": "4567a5e69fd3130ca0d89f69478e7ac025b67452"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/kr/fs",
|
||||
"Rev": "2788f0dbd16903de03cb8186e5c7d97b69ad387b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/goamz/aws",
|
||||
"Rev": "caaaea8b30ee15616494ee68abd5d8ebbbef05cf"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/goamz/s3",
|
||||
"Rev": "caaaea8b30ee15616494ee68abd5d8ebbbef05cf"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pkg/sftp",
|
||||
"Rev": "518aed2757a65cfa64d4b1b2baf08410f8b7a6bc"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/restic/chunker",
|
||||
"Rev": "e795b80f4c927ebcf2687ce18bcf1a39fee740b1"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/vaughan0/go-ini",
|
||||
"Rev": "a98ad7ee00ec53921f08832bc06ecf7fd600e6a1"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/crypto/pbkdf2",
|
||||
"Rev": "cc04154d65fb9296747569b107cfd05380b1ea3e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/crypto/poly1305",
|
||||
"Rev": "cc04154d65fb9296747569b107cfd05380b1ea3e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/crypto/scrypt",
|
||||
"Rev": "cc04154d65fb9296747569b107cfd05380b1ea3e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/crypto/ssh",
|
||||
"Rev": "cc04154d65fb9296747569b107cfd05380b1ea3e"
|
||||
}
|
||||
]
|
||||
}
|
||||
5
Godeps/Readme
generated
5
Godeps/Readme
generated
@@ -1,5 +0,0 @@
|
||||
This directory tree is generated automatically by godep.
|
||||
|
||||
Please do not edit.
|
||||
|
||||
See https://github.com/tools/godep for more information.
|
||||
2
Godeps/_workspace/.gitignore
generated
vendored
2
Godeps/_workspace/.gitignore
generated
vendored
@@ -1,2 +0,0 @@
|
||||
/pkg
|
||||
/bin
|
||||
4
Godeps/_workspace/src/bazil.org/fuse/doc/.gitignore
generated
vendored
4
Godeps/_workspace/src/bazil.org/fuse/doc/.gitignore
generated
vendored
@@ -1,4 +0,0 @@
|
||||
/*.seq.svg
|
||||
|
||||
# not ignoring *.seq.png; we want those committed to the repo
|
||||
# for embedding on Github
|
||||
6
Godeps/_workspace/src/bazil.org/fuse/doc/README.md
generated
vendored
6
Godeps/_workspace/src/bazil.org/fuse/doc/README.md
generated
vendored
@@ -1,6 +0,0 @@
|
||||
# bazil.org/fuse documentation
|
||||
|
||||
See also API docs at http://godoc.org/bazil.org/fuse
|
||||
|
||||
- [The mount sequence](mount-sequence.md)
|
||||
- [Writing documentation](writing-docs.md)
|
||||
32
Godeps/_workspace/src/bazil.org/fuse/doc/mount-linux-error-init.seq
generated
vendored
32
Godeps/_workspace/src/bazil.org/fuse/doc/mount-linux-error-init.seq
generated
vendored
@@ -1,32 +0,0 @@
|
||||
seqdiag {
|
||||
app;
|
||||
fuse [label="bazil.org/fuse"];
|
||||
fusermount;
|
||||
kernel;
|
||||
mounts;
|
||||
|
||||
app;
|
||||
fuse [label="bazil.org/fuse"];
|
||||
fusermount;
|
||||
kernel;
|
||||
mounts;
|
||||
|
||||
app -> fuse [label="Mount"];
|
||||
fuse -> fusermount [label="spawn, pass socketpair fd"];
|
||||
fusermount -> kernel [label="open /dev/fuse"];
|
||||
fusermount -> kernel [label="mount(2)"];
|
||||
kernel ->> mounts [label="mount is visible"];
|
||||
fusermount <-- kernel [label="mount(2) returns"];
|
||||
fuse <<-- fusermount [diagonal, label="exit, receive /dev/fuse fd", leftnote="on Linux, successful exit here\nmeans the mount has happened,\nthough InitRequest might not have yet"];
|
||||
app <-- fuse [label="Mount returns\nConn.Ready is already closed"];
|
||||
|
||||
app -> fuse [label="fs.Serve"];
|
||||
fuse => kernel [label="read /dev/fuse fd", note="starts with InitRequest"];
|
||||
fuse -> app [label="Init"];
|
||||
fuse <-- app [color=red];
|
||||
fuse -> kernel [label="write /dev/fuse fd", color=red];
|
||||
kernel -> kernel [label="set connection\nstate to error", color=red];
|
||||
fuse <-- kernel;
|
||||
... conn.MountError == nil, so it is still mounted ...
|
||||
... call conn.Close to clean up ...
|
||||
}
|
||||
BIN
Godeps/_workspace/src/bazil.org/fuse/doc/mount-linux-error-init.seq.png
generated
vendored
BIN
Godeps/_workspace/src/bazil.org/fuse/doc/mount-linux-error-init.seq.png
generated
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 28 KiB |
41
Godeps/_workspace/src/bazil.org/fuse/doc/mount-linux.seq
generated
vendored
41
Godeps/_workspace/src/bazil.org/fuse/doc/mount-linux.seq
generated
vendored
@@ -1,41 +0,0 @@
|
||||
seqdiag {
|
||||
// seqdiag -T svg -o doc/mount-osx.svg doc/mount-osx.seq
|
||||
app;
|
||||
fuse [label="bazil.org/fuse"];
|
||||
fusermount;
|
||||
kernel;
|
||||
mounts;
|
||||
|
||||
app -> fuse [label="Mount"];
|
||||
fuse -> fusermount [label="spawn, pass socketpair fd"];
|
||||
fusermount -> kernel [label="open /dev/fuse"];
|
||||
fusermount -> kernel [label="mount(2)"];
|
||||
kernel ->> mounts [label="mount is visible"];
|
||||
fusermount <-- kernel [label="mount(2) returns"];
|
||||
fuse <<-- fusermount [diagonal, label="exit, receive /dev/fuse fd", leftnote="on Linux, successful exit here\nmeans the mount has happened,\nthough InitRequest might not have yet"];
|
||||
app <-- fuse [label="Mount returns\nConn.Ready is already closed", rightnote="InitRequest and StatfsRequest\nmay or may not be seen\nbefore Conn.Ready,\ndepending on platform"];
|
||||
|
||||
app -> fuse [label="fs.Serve"];
|
||||
fuse => kernel [label="read /dev/fuse fd", note="starts with InitRequest"];
|
||||
fuse => app [label="FS/Node/Handle methods"];
|
||||
fuse => kernel [label="write /dev/fuse fd"];
|
||||
... repeat ...
|
||||
|
||||
... shutting down ...
|
||||
app -> fuse [label="Unmount"];
|
||||
fuse -> fusermount [label="fusermount -u"];
|
||||
fusermount -> kernel;
|
||||
kernel <<-- mounts;
|
||||
fusermount <-- kernel;
|
||||
fuse <<-- fusermount [diagonal];
|
||||
app <-- fuse [label="Unmount returns"];
|
||||
|
||||
// actually triggers before above
|
||||
fuse <<-- kernel [diagonal, label="/dev/fuse EOF"];
|
||||
app <-- fuse [label="fs.Serve returns"];
|
||||
|
||||
app -> fuse [label="conn.Close"];
|
||||
fuse -> kernel [label="close /dev/fuse fd"];
|
||||
fuse <-- kernel;
|
||||
app <-- fuse;
|
||||
}
|
||||
BIN
Godeps/_workspace/src/bazil.org/fuse/doc/mount-linux.seq.png
generated
vendored
BIN
Godeps/_workspace/src/bazil.org/fuse/doc/mount-linux.seq.png
generated
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 44 KiB |
32
Godeps/_workspace/src/bazil.org/fuse/doc/mount-osx-error-init.seq
generated
vendored
32
Godeps/_workspace/src/bazil.org/fuse/doc/mount-osx-error-init.seq
generated
vendored
@@ -1,32 +0,0 @@
|
||||
seqdiag {
|
||||
app;
|
||||
fuse [label="bazil.org/fuse"];
|
||||
wait [label="callMount\nhelper goroutine"];
|
||||
mount_osxfusefs;
|
||||
kernel;
|
||||
|
||||
app -> fuse [label="Mount"];
|
||||
fuse -> kernel [label="open /dev/osxfuseN"];
|
||||
fuse -> mount_osxfusefs [label="spawn, pass fd"];
|
||||
fuse -> wait [label="goroutine", note="blocks on cmd.Wait"];
|
||||
app <-- fuse [label="Mount returns"];
|
||||
|
||||
mount_osxfusefs -> kernel [label="mount(2)"];
|
||||
|
||||
app -> fuse [label="fs.Serve"];
|
||||
fuse => kernel [label="read /dev/osxfuseN fd", note="starts with InitRequest,\nalso seen before mount exits:\ntwo StatfsRequest calls"];
|
||||
fuse -> app [label="Init"];
|
||||
fuse <-- app [color=red];
|
||||
fuse -> kernel [label="write /dev/osxfuseN fd", color=red];
|
||||
fuse <-- kernel;
|
||||
|
||||
mount_osxfusefs <-- kernel [label="mount(2) returns", color=red];
|
||||
wait <<-- mount_osxfusefs [diagonal, label="exit", color=red];
|
||||
app <<-- wait [diagonal, label="mount has failed,\nclose Conn.Ready", color=red];
|
||||
|
||||
// actually triggers before above
|
||||
fuse <<-- kernel [diagonal, label="/dev/osxfuseN EOF"];
|
||||
app <-- fuse [label="fs.Serve returns"];
|
||||
... conn.MountError != nil, so it was was never mounted ...
|
||||
... call conn.Close to clean up ...
|
||||
}
|
||||
BIN
Godeps/_workspace/src/bazil.org/fuse/doc/mount-osx-error-init.seq.png
generated
vendored
BIN
Godeps/_workspace/src/bazil.org/fuse/doc/mount-osx-error-init.seq.png
generated
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 32 KiB |
45
Godeps/_workspace/src/bazil.org/fuse/doc/mount-osx.seq
generated
vendored
45
Godeps/_workspace/src/bazil.org/fuse/doc/mount-osx.seq
generated
vendored
@@ -1,45 +0,0 @@
|
||||
seqdiag {
|
||||
// seqdiag -T svg -o doc/mount-osx.svg doc/mount-osx.seq
|
||||
app;
|
||||
fuse [label="bazil.org/fuse"];
|
||||
wait [label="callMount\nhelper goroutine"];
|
||||
mount_osxfusefs;
|
||||
kernel;
|
||||
mounts;
|
||||
|
||||
app -> fuse [label="Mount"];
|
||||
fuse -> kernel [label="open /dev/osxfuseN"];
|
||||
fuse -> mount_osxfusefs [label="spawn, pass fd"];
|
||||
fuse -> wait [label="goroutine", note="blocks on cmd.Wait"];
|
||||
app <-- fuse [label="Mount returns"];
|
||||
|
||||
mount_osxfusefs -> kernel [label="mount(2)"];
|
||||
|
||||
app -> fuse [label="fs.Serve"];
|
||||
fuse => kernel [label="read /dev/osxfuseN fd", note="starts with InitRequest,\nalso seen before mount exits:\ntwo StatfsRequest calls"];
|
||||
fuse => app [label="FS/Node/Handle methods"];
|
||||
fuse => kernel [label="write /dev/osxfuseN fd"];
|
||||
... repeat ...
|
||||
|
||||
kernel ->> mounts [label="mount is visible"];
|
||||
mount_osxfusefs <-- kernel [label="mount(2) returns"];
|
||||
wait <<-- mount_osxfusefs [diagonal, label="exit", leftnote="on OS X, successful exit\nhere means we finally know\nthe mount has happened\n(can't trust InitRequest,\nkernel might have timed out\nwaiting for InitResponse)"];
|
||||
|
||||
app <<-- wait [diagonal, label="mount is ready,\nclose Conn.Ready", rightnote="InitRequest and StatfsRequest\nmay or may not be seen\nbefore Conn.Ready,\ndepending on platform"];
|
||||
|
||||
... shutting down ...
|
||||
app -> fuse [label="Unmount"];
|
||||
fuse -> kernel [label="umount(2)"];
|
||||
kernel <<-- mounts;
|
||||
fuse <-- kernel;
|
||||
app <-- fuse [label="Unmount returns"];
|
||||
|
||||
// actually triggers before above
|
||||
fuse <<-- kernel [diagonal, label="/dev/osxfuseN EOF"];
|
||||
app <-- fuse [label="fs.Serve returns"];
|
||||
|
||||
app -> fuse [label="conn.Close"];
|
||||
fuse -> kernel [label="close /dev/osxfuseN"];
|
||||
fuse <-- kernel;
|
||||
app <-- fuse;
|
||||
}
|
||||
BIN
Godeps/_workspace/src/bazil.org/fuse/doc/mount-osx.seq.png
generated
vendored
BIN
Godeps/_workspace/src/bazil.org/fuse/doc/mount-osx.seq.png
generated
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 50 KiB |
30
Godeps/_workspace/src/bazil.org/fuse/doc/mount-sequence.md
generated
vendored
30
Godeps/_workspace/src/bazil.org/fuse/doc/mount-sequence.md
generated
vendored
@@ -1,30 +0,0 @@
|
||||
# The mount sequence
|
||||
|
||||
FUSE mounting is a little bit tricky. There's a userspace helper tool
|
||||
that performs the handshake with the kernel, and then steps out of the
|
||||
way. This helper behaves differently on different platforms, forcing a
|
||||
more complex API on us.
|
||||
|
||||
## Successful runs
|
||||
|
||||
On Linux, the mount is immediate and file system accesses wait until
|
||||
the requests are served.
|
||||
|
||||

|
||||
|
||||
On OS X, the mount becomes visible only after `InitRequest` (and maybe
|
||||
more) have been served.
|
||||
|
||||

|
||||
|
||||
|
||||
## Errors
|
||||
|
||||
Let's see what happens if `InitRequest` gets an error response. On
|
||||
Linux, the mountpoint is there but all operations will fail:
|
||||
|
||||

|
||||
|
||||
On OS X, the mount never happened:
|
||||
|
||||

|
||||
16
Godeps/_workspace/src/bazil.org/fuse/doc/writing-docs.md
generated
vendored
16
Godeps/_workspace/src/bazil.org/fuse/doc/writing-docs.md
generated
vendored
@@ -1,16 +0,0 @@
|
||||
# Writing documentation
|
||||
|
||||
## Sequence diagrams
|
||||
|
||||
The sequence diagrams are generated with `seqdiag`:
|
||||
http://blockdiag.com/en/seqdiag/index.html
|
||||
|
||||
An easy way to work on them is to automatically update the generated
|
||||
files with https://github.com/cespare/reflex :
|
||||
|
||||
reflex -g 'doc/[^.]*.seq' -- seqdiag -T svg -o '{}.svg' '{}' &
|
||||
|
||||
reflex -g 'doc/[^.]*.seq' -- seqdiag -T png -o '{}.png' '{}' &
|
||||
|
||||
The markdown files refer to PNG images because of Github limitations,
|
||||
but the SVG is generally more pleasant to view.
|
||||
173
Godeps/_workspace/src/bazil.org/fuse/examples/clockfs/clockfs.go
generated
vendored
173
Godeps/_workspace/src/bazil.org/fuse/examples/clockfs/clockfs.go
generated
vendored
@@ -1,173 +0,0 @@
|
||||
// Clockfs implements a file system with the current time in a file.
|
||||
// It was written to demonstrate kernel cache invalidation.
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"sync/atomic"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"bazil.org/fuse"
|
||||
"bazil.org/fuse/fs"
|
||||
_ "bazil.org/fuse/fs/fstestutil"
|
||||
"bazil.org/fuse/fuseutil"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
func usage() {
|
||||
fmt.Fprintf(os.Stderr, "Usage of %s:\n", os.Args[0])
|
||||
fmt.Fprintf(os.Stderr, " %s MOUNTPOINT\n", os.Args[0])
|
||||
flag.PrintDefaults()
|
||||
}
|
||||
|
||||
func main() {
|
||||
flag.Usage = usage
|
||||
flag.Parse()
|
||||
|
||||
if flag.NArg() != 1 {
|
||||
usage()
|
||||
os.Exit(2)
|
||||
}
|
||||
mountpoint := flag.Arg(0)
|
||||
|
||||
c, err := fuse.Mount(
|
||||
mountpoint,
|
||||
fuse.FSName("clock"),
|
||||
fuse.Subtype("clockfsfs"),
|
||||
fuse.LocalVolume(),
|
||||
fuse.VolumeName("Clock filesystem"),
|
||||
)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
defer c.Close()
|
||||
|
||||
srv := fs.New(c, nil)
|
||||
filesys := &FS{
|
||||
// We pre-create the clock node so that it's always the same
|
||||
// object returned from all the Lookups. You could carefully
|
||||
// track its lifetime between Lookup&Forget, and have the
|
||||
// ticking & invalidation happen only when active, but let's
|
||||
// keep this example simple.
|
||||
clockFile: &File{
|
||||
fuse: srv,
|
||||
},
|
||||
}
|
||||
filesys.clockFile.tick()
|
||||
// This goroutine never exits. That's fine for this example.
|
||||
go filesys.clockFile.update()
|
||||
if err := srv.Serve(filesys); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
// Check if the mount process has an error to report.
|
||||
<-c.Ready
|
||||
if err := c.MountError; err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
type FS struct {
|
||||
clockFile *File
|
||||
}
|
||||
|
||||
var _ fs.FS = (*FS)(nil)
|
||||
|
||||
func (f *FS) Root() (fs.Node, error) {
|
||||
return &Dir{fs: f}, nil
|
||||
}
|
||||
|
||||
// Dir implements both Node and Handle for the root directory.
|
||||
type Dir struct {
|
||||
fs *FS
|
||||
}
|
||||
|
||||
var _ fs.Node = (*Dir)(nil)
|
||||
|
||||
func (d *Dir) Attr(ctx context.Context, a *fuse.Attr) error {
|
||||
a.Inode = 1
|
||||
a.Mode = os.ModeDir | 0555
|
||||
return nil
|
||||
}
|
||||
|
||||
var _ fs.NodeStringLookuper = (*Dir)(nil)
|
||||
|
||||
func (d *Dir) Lookup(ctx context.Context, name string) (fs.Node, error) {
|
||||
if name == "clock" {
|
||||
return d.fs.clockFile, nil
|
||||
}
|
||||
return nil, fuse.ENOENT
|
||||
}
|
||||
|
||||
var dirDirs = []fuse.Dirent{
|
||||
{Inode: 2, Name: "clock", Type: fuse.DT_File},
|
||||
}
|
||||
|
||||
var _ fs.HandleReadDirAller = (*Dir)(nil)
|
||||
|
||||
func (d *Dir) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) {
|
||||
return dirDirs, nil
|
||||
}
|
||||
|
||||
type File struct {
|
||||
fs.NodeRef
|
||||
fuse *fs.Server
|
||||
content atomic.Value
|
||||
count uint64
|
||||
}
|
||||
|
||||
var _ fs.Node = (*File)(nil)
|
||||
|
||||
func (f *File) Attr(ctx context.Context, a *fuse.Attr) error {
|
||||
a.Inode = 2
|
||||
a.Mode = 0444
|
||||
t := f.content.Load().(string)
|
||||
a.Size = uint64(len(t))
|
||||
return nil
|
||||
}
|
||||
|
||||
var _ fs.NodeOpener = (*File)(nil)
|
||||
|
||||
func (f *File) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.OpenResponse) (fs.Handle, error) {
|
||||
if !req.Flags.IsReadOnly() {
|
||||
return nil, fuse.Errno(syscall.EACCES)
|
||||
}
|
||||
resp.Flags |= fuse.OpenKeepCache
|
||||
return f, nil
|
||||
}
|
||||
|
||||
var _ fs.Handle = (*File)(nil)
|
||||
|
||||
var _ fs.HandleReader = (*File)(nil)
|
||||
|
||||
func (f *File) Read(ctx context.Context, req *fuse.ReadRequest, resp *fuse.ReadResponse) error {
|
||||
t := f.content.Load().(string)
|
||||
fuseutil.HandleRead(req, resp, []byte(t))
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f *File) tick() {
|
||||
// Intentionally a variable-length format, to demonstrate size changes.
|
||||
f.count++
|
||||
s := fmt.Sprintf("%d\t%s\n", f.count, time.Now())
|
||||
f.content.Store(s)
|
||||
|
||||
// For simplicity, this example tries to send invalidate
|
||||
// notifications even when the kernel does not hold a reference to
|
||||
// the node, so be extra sure to ignore ErrNotCached.
|
||||
if err := f.fuse.InvalidateNodeData(f); err != nil && err != fuse.ErrNotCached {
|
||||
log.Printf("invalidate error: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func (f *File) update() {
|
||||
tick := time.NewTicker(1 * time.Second)
|
||||
defer tick.Stop()
|
||||
for range tick.C {
|
||||
f.tick()
|
||||
}
|
||||
}
|
||||
101
Godeps/_workspace/src/bazil.org/fuse/examples/hellofs/hello.go
generated
vendored
101
Godeps/_workspace/src/bazil.org/fuse/examples/hellofs/hello.go
generated
vendored
@@ -1,101 +0,0 @@
|
||||
// Hellofs implements a simple "hello world" file system.
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"bazil.org/fuse"
|
||||
"bazil.org/fuse/fs"
|
||||
_ "bazil.org/fuse/fs/fstestutil"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
var Usage = func() {
|
||||
fmt.Fprintf(os.Stderr, "Usage of %s:\n", os.Args[0])
|
||||
fmt.Fprintf(os.Stderr, " %s MOUNTPOINT\n", os.Args[0])
|
||||
flag.PrintDefaults()
|
||||
}
|
||||
|
||||
func main() {
|
||||
flag.Usage = Usage
|
||||
flag.Parse()
|
||||
|
||||
if flag.NArg() != 1 {
|
||||
Usage()
|
||||
os.Exit(2)
|
||||
}
|
||||
mountpoint := flag.Arg(0)
|
||||
|
||||
c, err := fuse.Mount(
|
||||
mountpoint,
|
||||
fuse.FSName("helloworld"),
|
||||
fuse.Subtype("hellofs"),
|
||||
fuse.LocalVolume(),
|
||||
fuse.VolumeName("Hello world!"),
|
||||
)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
defer c.Close()
|
||||
|
||||
err = fs.Serve(c, FS{})
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
// check if the mount process has an error to report
|
||||
<-c.Ready
|
||||
if err := c.MountError; err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
// FS implements the hello world file system.
|
||||
type FS struct{}
|
||||
|
||||
func (FS) Root() (fs.Node, error) {
|
||||
return Dir{}, nil
|
||||
}
|
||||
|
||||
// Dir implements both Node and Handle for the root directory.
|
||||
type Dir struct{}
|
||||
|
||||
func (Dir) Attr(ctx context.Context, a *fuse.Attr) error {
|
||||
a.Inode = 1
|
||||
a.Mode = os.ModeDir | 0555
|
||||
return nil
|
||||
}
|
||||
|
||||
func (Dir) Lookup(ctx context.Context, name string) (fs.Node, error) {
|
||||
if name == "hello" {
|
||||
return File{}, nil
|
||||
}
|
||||
return nil, fuse.ENOENT
|
||||
}
|
||||
|
||||
var dirDirs = []fuse.Dirent{
|
||||
{Inode: 2, Name: "hello", Type: fuse.DT_File},
|
||||
}
|
||||
|
||||
func (Dir) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) {
|
||||
return dirDirs, nil
|
||||
}
|
||||
|
||||
// File implements both Node and Handle for the hello file.
|
||||
type File struct{}
|
||||
|
||||
const greeting = "hello, world\n"
|
||||
|
||||
func (File) Attr(ctx context.Context, a *fuse.Attr) error {
|
||||
a.Inode = 2
|
||||
a.Mode = 0444
|
||||
a.Size = uint64(len(greeting))
|
||||
return nil
|
||||
}
|
||||
|
||||
func (File) ReadAll(ctx context.Context) ([]byte, error) {
|
||||
return []byte(greeting), nil
|
||||
}
|
||||
268
Godeps/_workspace/src/bazil.org/fuse/fs/bench/bench_test.go
generated
vendored
268
Godeps/_workspace/src/bazil.org/fuse/fs/bench/bench_test.go
generated
vendored
@@ -1,268 +0,0 @@
|
||||
package bench_test
|
||||
|
||||
import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
"testing"
|
||||
|
||||
"bazil.org/fuse"
|
||||
"bazil.org/fuse/fs"
|
||||
"bazil.org/fuse/fs/fstestutil"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
type benchConfig struct {
|
||||
directIO bool
|
||||
}
|
||||
|
||||
type benchFS struct {
|
||||
conf *benchConfig
|
||||
}
|
||||
|
||||
var _ = fs.FS(benchFS{})
|
||||
|
||||
func (f benchFS) Root() (fs.Node, error) {
|
||||
return benchDir{conf: f.conf}, nil
|
||||
}
|
||||
|
||||
type benchDir struct {
|
||||
conf *benchConfig
|
||||
}
|
||||
|
||||
var _ = fs.Node(benchDir{})
|
||||
var _ = fs.NodeStringLookuper(benchDir{})
|
||||
var _ = fs.Handle(benchDir{})
|
||||
var _ = fs.HandleReadDirAller(benchDir{})
|
||||
|
||||
func (benchDir) Attr(ctx context.Context, a *fuse.Attr) error {
|
||||
a.Inode = 1
|
||||
a.Mode = os.ModeDir | 0555
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d benchDir) Lookup(ctx context.Context, name string) (fs.Node, error) {
|
||||
if name == "bench" {
|
||||
return benchFile{conf: d.conf}, nil
|
||||
}
|
||||
return nil, fuse.ENOENT
|
||||
}
|
||||
|
||||
func (benchDir) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) {
|
||||
l := []fuse.Dirent{
|
||||
{Inode: 2, Name: "bench", Type: fuse.DT_File},
|
||||
}
|
||||
return l, nil
|
||||
}
|
||||
|
||||
type benchFile struct {
|
||||
conf *benchConfig
|
||||
}
|
||||
|
||||
var _ = fs.Node(benchFile{})
|
||||
var _ = fs.NodeOpener(benchFile{})
|
||||
var _ = fs.NodeFsyncer(benchFile{})
|
||||
var _ = fs.Handle(benchFile{})
|
||||
var _ = fs.HandleReader(benchFile{})
|
||||
var _ = fs.HandleWriter(benchFile{})
|
||||
|
||||
func (benchFile) Attr(ctx context.Context, a *fuse.Attr) error {
|
||||
a.Inode = 2
|
||||
a.Mode = 0644
|
||||
a.Size = 9999999999999999
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f benchFile) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.OpenResponse) (fs.Handle, error) {
|
||||
if f.conf.directIO {
|
||||
resp.Flags |= fuse.OpenDirectIO
|
||||
}
|
||||
// TODO configurable?
|
||||
resp.Flags |= fuse.OpenKeepCache
|
||||
return f, nil
|
||||
}
|
||||
|
||||
func (benchFile) Read(ctx context.Context, req *fuse.ReadRequest, resp *fuse.ReadResponse) error {
|
||||
resp.Data = resp.Data[:cap(resp.Data)]
|
||||
return nil
|
||||
}
|
||||
|
||||
func (benchFile) Write(ctx context.Context, req *fuse.WriteRequest, resp *fuse.WriteResponse) error {
|
||||
resp.Size = len(req.Data)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (benchFile) Fsync(ctx context.Context, req *fuse.FsyncRequest) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func benchmark(b *testing.B, fn func(b *testing.B, mnt string), conf *benchConfig) {
|
||||
filesys := benchFS{
|
||||
conf: conf,
|
||||
}
|
||||
mnt, err := fstestutil.Mounted(filesys, nil,
|
||||
fuse.MaxReadahead(64*1024*1024),
|
||||
fuse.AsyncRead(),
|
||||
fuse.WritebackCache(),
|
||||
)
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
defer mnt.Close()
|
||||
|
||||
fn(b, mnt.Dir)
|
||||
}
|
||||
|
||||
type zero struct{}
|
||||
|
||||
func (zero) Read(p []byte) (n int, err error) {
|
||||
return len(p), nil
|
||||
}
|
||||
|
||||
var Zero io.Reader = zero{}
|
||||
|
||||
func doWrites(size int64) func(b *testing.B, mnt string) {
|
||||
return func(b *testing.B, mnt string) {
|
||||
p := path.Join(mnt, "bench")
|
||||
|
||||
f, err := os.Create(p)
|
||||
if err != nil {
|
||||
b.Fatalf("create: %v", err)
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
b.ResetTimer()
|
||||
b.SetBytes(size)
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
_, err = io.CopyN(f, Zero, size)
|
||||
if err != nil {
|
||||
b.Fatalf("write: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkWrite100(b *testing.B) {
|
||||
benchmark(b, doWrites(100), &benchConfig{})
|
||||
}
|
||||
|
||||
func BenchmarkWrite10MB(b *testing.B) {
|
||||
benchmark(b, doWrites(10*1024*1024), &benchConfig{})
|
||||
}
|
||||
|
||||
func BenchmarkWrite100MB(b *testing.B) {
|
||||
benchmark(b, doWrites(100*1024*1024), &benchConfig{})
|
||||
}
|
||||
|
||||
func BenchmarkDirectWrite100(b *testing.B) {
|
||||
benchmark(b, doWrites(100), &benchConfig{
|
||||
directIO: true,
|
||||
})
|
||||
}
|
||||
|
||||
func BenchmarkDirectWrite10MB(b *testing.B) {
|
||||
benchmark(b, doWrites(10*1024*1024), &benchConfig{
|
||||
directIO: true,
|
||||
})
|
||||
}
|
||||
|
||||
func BenchmarkDirectWrite100MB(b *testing.B) {
|
||||
benchmark(b, doWrites(100*1024*1024), &benchConfig{
|
||||
directIO: true,
|
||||
})
|
||||
}
|
||||
|
||||
func doWritesSync(size int64) func(b *testing.B, mnt string) {
|
||||
return func(b *testing.B, mnt string) {
|
||||
p := path.Join(mnt, "bench")
|
||||
|
||||
f, err := os.Create(p)
|
||||
if err != nil {
|
||||
b.Fatalf("create: %v", err)
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
b.ResetTimer()
|
||||
b.SetBytes(size)
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
_, err = io.CopyN(f, Zero, size)
|
||||
if err != nil {
|
||||
b.Fatalf("write: %v", err)
|
||||
}
|
||||
|
||||
if err := f.Sync(); err != nil {
|
||||
b.Fatalf("sync: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkWriteSync100(b *testing.B) {
|
||||
benchmark(b, doWritesSync(100), &benchConfig{})
|
||||
}
|
||||
|
||||
func BenchmarkWriteSync10MB(b *testing.B) {
|
||||
benchmark(b, doWritesSync(10*1024*1024), &benchConfig{})
|
||||
}
|
||||
|
||||
func BenchmarkWriteSync100MB(b *testing.B) {
|
||||
benchmark(b, doWritesSync(100*1024*1024), &benchConfig{})
|
||||
}
|
||||
|
||||
func doReads(size int64) func(b *testing.B, mnt string) {
|
||||
return func(b *testing.B, mnt string) {
|
||||
p := path.Join(mnt, "bench")
|
||||
|
||||
f, err := os.Open(p)
|
||||
if err != nil {
|
||||
b.Fatalf("close: %v", err)
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
b.ResetTimer()
|
||||
b.SetBytes(size)
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
n, err := io.CopyN(ioutil.Discard, f, size)
|
||||
if err != nil {
|
||||
b.Fatalf("read: %v", err)
|
||||
}
|
||||
if n != size {
|
||||
b.Errorf("unexpected size: %d != %d", n, size)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkRead100(b *testing.B) {
|
||||
benchmark(b, doReads(100), &benchConfig{})
|
||||
}
|
||||
|
||||
func BenchmarkRead10MB(b *testing.B) {
|
||||
benchmark(b, doReads(10*1024*1024), &benchConfig{})
|
||||
}
|
||||
|
||||
func BenchmarkRead100MB(b *testing.B) {
|
||||
benchmark(b, doReads(100*1024*1024), &benchConfig{})
|
||||
}
|
||||
|
||||
func BenchmarkDirectRead100(b *testing.B) {
|
||||
benchmark(b, doReads(100), &benchConfig{
|
||||
directIO: true,
|
||||
})
|
||||
}
|
||||
|
||||
func BenchmarkDirectRead10MB(b *testing.B) {
|
||||
benchmark(b, doReads(10*1024*1024), &benchConfig{
|
||||
directIO: true,
|
||||
})
|
||||
}
|
||||
|
||||
func BenchmarkDirectRead100MB(b *testing.B) {
|
||||
benchmark(b, doReads(100*1024*1024), &benchConfig{
|
||||
directIO: true,
|
||||
})
|
||||
}
|
||||
5
Godeps/_workspace/src/bazil.org/fuse/fs/bench/doc.go
generated
vendored
5
Godeps/_workspace/src/bazil.org/fuse/fs/bench/doc.go
generated
vendored
@@ -1,5 +0,0 @@
|
||||
// Package bench contains benchmarks.
|
||||
//
|
||||
// It is kept in a separate package to avoid conflicting with the
|
||||
// debug-heavy defaults for the actual tests.
|
||||
package bench
|
||||
65
Godeps/_workspace/src/bazil.org/fuse/fs/fstestutil/debug.go
generated
vendored
65
Godeps/_workspace/src/bazil.org/fuse/fs/fstestutil/debug.go
generated
vendored
@@ -1,65 +0,0 @@
|
||||
package fstestutil
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"log"
|
||||
"strconv"
|
||||
|
||||
"bazil.org/fuse"
|
||||
)
|
||||
|
||||
type flagDebug bool
|
||||
|
||||
var debug flagDebug
|
||||
|
||||
var _ = flag.Value(&debug)
|
||||
|
||||
func (f *flagDebug) IsBoolFlag() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func nop(msg interface{}) {}
|
||||
|
||||
func (f *flagDebug) Set(s string) error {
|
||||
v, err := strconv.ParseBool(s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*f = flagDebug(v)
|
||||
if v {
|
||||
fuse.Debug = logMsg
|
||||
} else {
|
||||
fuse.Debug = nop
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f *flagDebug) String() string {
|
||||
return strconv.FormatBool(bool(*f))
|
||||
}
|
||||
|
||||
func logMsg(msg interface{}) {
|
||||
log.Printf("FUSE: %s\n", msg)
|
||||
}
|
||||
|
||||
func init() {
|
||||
flag.Var(&debug, "fuse.debug", "log FUSE processing details")
|
||||
}
|
||||
|
||||
// DebugByDefault changes the default of the `-fuse.debug` flag to
|
||||
// true.
|
||||
//
|
||||
// This package registers a command line flag `-fuse.debug` and when
|
||||
// run with that flag (and activated inside the tests), logs FUSE
|
||||
// debug messages.
|
||||
//
|
||||
// This is disabled by default, as most callers probably won't care
|
||||
// about FUSE details. Use DebugByDefault for tests where you'd
|
||||
// normally be passing `-fuse.debug` all the time anyway.
|
||||
//
|
||||
// Call from an init function.
|
||||
func DebugByDefault() {
|
||||
f := flag.Lookup("fuse.debug")
|
||||
f.DefValue = "true"
|
||||
f.Value.Set(f.DefValue)
|
||||
}
|
||||
1
Godeps/_workspace/src/bazil.org/fuse/fs/fstestutil/doc.go
generated
vendored
1
Godeps/_workspace/src/bazil.org/fuse/fs/fstestutil/doc.go
generated
vendored
@@ -1 +0,0 @@
|
||||
package fstestutil
|
||||
115
Godeps/_workspace/src/bazil.org/fuse/fs/fstestutil/mounted.go
generated
vendored
115
Godeps/_workspace/src/bazil.org/fuse/fs/fstestutil/mounted.go
generated
vendored
@@ -1,115 +0,0 @@
|
||||
package fstestutil
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"bazil.org/fuse"
|
||||
"bazil.org/fuse/fs"
|
||||
)
|
||||
|
||||
// Mount contains information about the mount for the test to use.
|
||||
type Mount struct {
|
||||
// Dir is the temporary directory where the filesystem is mounted.
|
||||
Dir string
|
||||
|
||||
Conn *fuse.Conn
|
||||
Server *fs.Server
|
||||
|
||||
// Error will receive the return value of Serve.
|
||||
Error <-chan error
|
||||
|
||||
done <-chan struct{}
|
||||
closed bool
|
||||
}
|
||||
|
||||
// Close unmounts the filesystem and waits for fs.Serve to return. Any
|
||||
// returned error will be stored in Err. It is safe to call Close
|
||||
// multiple times.
|
||||
func (mnt *Mount) Close() {
|
||||
if mnt.closed {
|
||||
return
|
||||
}
|
||||
mnt.closed = true
|
||||
for tries := 0; tries < 1000; tries++ {
|
||||
err := fuse.Unmount(mnt.Dir)
|
||||
if err != nil {
|
||||
// TODO do more than log?
|
||||
log.Printf("unmount error: %v", err)
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
continue
|
||||
}
|
||||
break
|
||||
}
|
||||
<-mnt.done
|
||||
mnt.Conn.Close()
|
||||
os.Remove(mnt.Dir)
|
||||
}
|
||||
|
||||
// Mounted mounts the fuse.Server at a temporary directory.
|
||||
//
|
||||
// It also waits until the filesystem is known to be visible (OS X
|
||||
// workaround).
|
||||
//
|
||||
// After successful return, caller must clean up by calling Close.
|
||||
func Mounted(filesys fs.FS, conf *fs.Config, options ...fuse.MountOption) (*Mount, error) {
|
||||
dir, err := ioutil.TempDir("", "fusetest")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
c, err := fuse.Mount(dir, options...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
server := fs.New(c, conf)
|
||||
done := make(chan struct{})
|
||||
serveErr := make(chan error, 1)
|
||||
mnt := &Mount{
|
||||
Dir: dir,
|
||||
Conn: c,
|
||||
Server: server,
|
||||
Error: serveErr,
|
||||
done: done,
|
||||
}
|
||||
go func() {
|
||||
defer close(done)
|
||||
serveErr <- server.Serve(filesys)
|
||||
}()
|
||||
|
||||
select {
|
||||
case <-mnt.Conn.Ready:
|
||||
if err := mnt.Conn.MountError; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return mnt, nil
|
||||
case err = <-mnt.Error:
|
||||
// Serve quit early
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, errors.New("Serve exited early")
|
||||
}
|
||||
}
|
||||
|
||||
// MountedT mounts the filesystem at a temporary directory,
|
||||
// directing it's debug log to the testing logger.
|
||||
//
|
||||
// See Mounted for usage.
|
||||
//
|
||||
// The debug log is not enabled by default. Use `-fuse.debug` or call
|
||||
// DebugByDefault to enable.
|
||||
func MountedT(t testing.TB, filesys fs.FS, conf *fs.Config, options ...fuse.MountOption) (*Mount, error) {
|
||||
if conf == nil {
|
||||
conf = &fs.Config{}
|
||||
}
|
||||
if debug && conf.Debug == nil {
|
||||
conf.Debug = func(msg interface{}) {
|
||||
t.Logf("FUSE: %s", msg)
|
||||
}
|
||||
}
|
||||
return Mounted(filesys, conf, options...)
|
||||
}
|
||||
26
Godeps/_workspace/src/bazil.org/fuse/fs/fstestutil/mountinfo.go
generated
vendored
26
Godeps/_workspace/src/bazil.org/fuse/fs/fstestutil/mountinfo.go
generated
vendored
@@ -1,26 +0,0 @@
|
||||
package fstestutil
|
||||
|
||||
// MountInfo describes a mounted file system.
|
||||
type MountInfo struct {
|
||||
FSName string
|
||||
Type string
|
||||
}
|
||||
|
||||
// GetMountInfo finds information about the mount at mnt. It is
|
||||
// intended for use by tests only, and only fetches information
|
||||
// relevant to the current tests.
|
||||
func GetMountInfo(mnt string) (*MountInfo, error) {
|
||||
return getMountInfo(mnt)
|
||||
}
|
||||
|
||||
// cstr converts a nil-terminated C string into a Go string
|
||||
func cstr(ca []int8) string {
|
||||
s := make([]byte, 0, len(ca))
|
||||
for _, c := range ca {
|
||||
if c == 0x00 {
|
||||
break
|
||||
}
|
||||
s = append(s, byte(c))
|
||||
}
|
||||
return string(s)
|
||||
}
|
||||
29
Godeps/_workspace/src/bazil.org/fuse/fs/fstestutil/mountinfo_darwin.go
generated
vendored
29
Godeps/_workspace/src/bazil.org/fuse/fs/fstestutil/mountinfo_darwin.go
generated
vendored
@@ -1,29 +0,0 @@
|
||||
package fstestutil
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
var re = regexp.MustCompile(`\\(.)`)
|
||||
|
||||
// unescape removes backslash-escaping. The escaped characters are not
|
||||
// mapped in any way; that is, unescape(`\n` ) == `n`.
|
||||
func unescape(s string) string {
|
||||
return re.ReplaceAllString(s, `$1`)
|
||||
}
|
||||
|
||||
func getMountInfo(mnt string) (*MountInfo, error) {
|
||||
var st syscall.Statfs_t
|
||||
err := syscall.Statfs(mnt, &st)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
i := &MountInfo{
|
||||
// osx getmntent(3) fails to un-escape the data, so we do it..
|
||||
// this might lead to double-unescaping in the future. fun.
|
||||
// TestMountOptionFSNameEvilBackslashDouble checks for that.
|
||||
FSName: unescape(cstr(st.Mntfromname[:])),
|
||||
}
|
||||
return i, nil
|
||||
}
|
||||
7
Godeps/_workspace/src/bazil.org/fuse/fs/fstestutil/mountinfo_freebsd.go
generated
vendored
7
Godeps/_workspace/src/bazil.org/fuse/fs/fstestutil/mountinfo_freebsd.go
generated
vendored
@@ -1,7 +0,0 @@
|
||||
package fstestutil
|
||||
|
||||
import "errors"
|
||||
|
||||
func getMountInfo(mnt string) (*MountInfo, error) {
|
||||
return nil, errors.New("FreeBSD has no useful mount information")
|
||||
}
|
||||
51
Godeps/_workspace/src/bazil.org/fuse/fs/fstestutil/mountinfo_linux.go
generated
vendored
51
Godeps/_workspace/src/bazil.org/fuse/fs/fstestutil/mountinfo_linux.go
generated
vendored
@@ -1,51 +0,0 @@
|
||||
package fstestutil
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Linux /proc/mounts shows current mounts.
|
||||
// Same format as /etc/fstab. Quoting getmntent(3):
|
||||
//
|
||||
// Since fields in the mtab and fstab files are separated by whitespace,
|
||||
// octal escapes are used to represent the four characters space (\040),
|
||||
// tab (\011), newline (\012) and backslash (\134) in those files when
|
||||
// they occur in one of the four strings in a mntent structure.
|
||||
//
|
||||
// http://linux.die.net/man/3/getmntent
|
||||
|
||||
var fstabUnescape = strings.NewReplacer(
|
||||
`\040`, "\040",
|
||||
`\011`, "\011",
|
||||
`\012`, "\012",
|
||||
`\134`, "\134",
|
||||
)
|
||||
|
||||
var errNotFound = errors.New("mount not found")
|
||||
|
||||
func getMountInfo(mnt string) (*MountInfo, error) {
|
||||
data, err := ioutil.ReadFile("/proc/mounts")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, line := range strings.Split(string(data), "\n") {
|
||||
fields := strings.Fields(line)
|
||||
if len(fields) < 3 {
|
||||
continue
|
||||
}
|
||||
// Fields are: fsname dir type opts freq passno
|
||||
fsname := fstabUnescape.Replace(fields[0])
|
||||
dir := fstabUnescape.Replace(fields[1])
|
||||
fstype := fstabUnescape.Replace(fields[2])
|
||||
if mnt == dir {
|
||||
info := &MountInfo{
|
||||
FSName: fsname,
|
||||
Type: fstype,
|
||||
}
|
||||
return info, nil
|
||||
}
|
||||
}
|
||||
return nil, errNotFound
|
||||
}
|
||||
28
Godeps/_workspace/src/bazil.org/fuse/fs/fstestutil/record/buffer.go
generated
vendored
28
Godeps/_workspace/src/bazil.org/fuse/fs/fstestutil/record/buffer.go
generated
vendored
@@ -1,28 +0,0 @@
|
||||
package record
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"sync"
|
||||
)
|
||||
|
||||
// Buffer is like bytes.Buffer but safe to access from multiple
|
||||
// goroutines.
|
||||
type Buffer struct {
|
||||
mu sync.Mutex
|
||||
buf bytes.Buffer
|
||||
}
|
||||
|
||||
var _ = io.Writer(&Buffer{})
|
||||
|
||||
func (b *Buffer) Write(p []byte) (n int, err error) {
|
||||
b.mu.Lock()
|
||||
defer b.mu.Unlock()
|
||||
return b.buf.Write(p)
|
||||
}
|
||||
|
||||
func (b *Buffer) Bytes() []byte {
|
||||
b.mu.Lock()
|
||||
defer b.mu.Unlock()
|
||||
return b.buf.Bytes()
|
||||
}
|
||||
384
Godeps/_workspace/src/bazil.org/fuse/fs/fstestutil/record/record.go
generated
vendored
384
Godeps/_workspace/src/bazil.org/fuse/fs/fstestutil/record/record.go
generated
vendored
@@ -1,384 +0,0 @@
|
||||
package record
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
||||
"bazil.org/fuse"
|
||||
"bazil.org/fuse/fs"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// Writes gathers data from FUSE Write calls.
|
||||
type Writes struct {
|
||||
buf Buffer
|
||||
}
|
||||
|
||||
var _ = fs.HandleWriter(&Writes{})
|
||||
|
||||
func (w *Writes) Write(ctx context.Context, req *fuse.WriteRequest, resp *fuse.WriteResponse) error {
|
||||
n, err := w.buf.Write(req.Data)
|
||||
resp.Size = n
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (w *Writes) RecordedWriteData() []byte {
|
||||
return w.buf.Bytes()
|
||||
}
|
||||
|
||||
// Counter records number of times a thing has occurred.
|
||||
type Counter struct {
|
||||
count uint32
|
||||
}
|
||||
|
||||
func (r *Counter) Inc() {
|
||||
atomic.AddUint32(&r.count, 1)
|
||||
}
|
||||
|
||||
func (r *Counter) Count() uint32 {
|
||||
return atomic.LoadUint32(&r.count)
|
||||
}
|
||||
|
||||
// MarkRecorder records whether a thing has occurred.
|
||||
type MarkRecorder struct {
|
||||
count Counter
|
||||
}
|
||||
|
||||
func (r *MarkRecorder) Mark() {
|
||||
r.count.Inc()
|
||||
}
|
||||
|
||||
func (r *MarkRecorder) Recorded() bool {
|
||||
return r.count.Count() > 0
|
||||
}
|
||||
|
||||
// Flushes notes whether a FUSE Flush call has been seen.
|
||||
type Flushes struct {
|
||||
rec MarkRecorder
|
||||
}
|
||||
|
||||
var _ = fs.HandleFlusher(&Flushes{})
|
||||
|
||||
func (r *Flushes) Flush(ctx context.Context, req *fuse.FlushRequest) error {
|
||||
r.rec.Mark()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *Flushes) RecordedFlush() bool {
|
||||
return r.rec.Recorded()
|
||||
}
|
||||
|
||||
type Recorder struct {
|
||||
mu sync.Mutex
|
||||
val interface{}
|
||||
}
|
||||
|
||||
// Record that we've seen value. A nil value is indistinguishable from
|
||||
// no value recorded.
|
||||
func (r *Recorder) Record(value interface{}) {
|
||||
r.mu.Lock()
|
||||
r.val = value
|
||||
r.mu.Unlock()
|
||||
}
|
||||
|
||||
func (r *Recorder) Recorded() interface{} {
|
||||
r.mu.Lock()
|
||||
val := r.val
|
||||
r.mu.Unlock()
|
||||
return val
|
||||
}
|
||||
|
||||
type RequestRecorder struct {
|
||||
rec Recorder
|
||||
}
|
||||
|
||||
// Record a fuse.Request, after zeroing header fields that are hard to
|
||||
// reproduce.
|
||||
//
|
||||
// Make sure to record a copy, not the original request.
|
||||
func (r *RequestRecorder) RecordRequest(req fuse.Request) {
|
||||
hdr := req.Hdr()
|
||||
*hdr = fuse.Header{}
|
||||
r.rec.Record(req)
|
||||
}
|
||||
|
||||
func (r *RequestRecorder) Recorded() fuse.Request {
|
||||
val := r.rec.Recorded()
|
||||
if val == nil {
|
||||
return nil
|
||||
}
|
||||
return val.(fuse.Request)
|
||||
}
|
||||
|
||||
// Setattrs records a Setattr request and its fields.
|
||||
type Setattrs struct {
|
||||
rec RequestRecorder
|
||||
}
|
||||
|
||||
var _ = fs.NodeSetattrer(&Setattrs{})
|
||||
|
||||
func (r *Setattrs) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *fuse.SetattrResponse) error {
|
||||
tmp := *req
|
||||
r.rec.RecordRequest(&tmp)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *Setattrs) RecordedSetattr() fuse.SetattrRequest {
|
||||
val := r.rec.Recorded()
|
||||
if val == nil {
|
||||
return fuse.SetattrRequest{}
|
||||
}
|
||||
return *(val.(*fuse.SetattrRequest))
|
||||
}
|
||||
|
||||
// Fsyncs records an Fsync request and its fields.
|
||||
type Fsyncs struct {
|
||||
rec RequestRecorder
|
||||
}
|
||||
|
||||
var _ = fs.NodeFsyncer(&Fsyncs{})
|
||||
|
||||
func (r *Fsyncs) Fsync(ctx context.Context, req *fuse.FsyncRequest) error {
|
||||
tmp := *req
|
||||
r.rec.RecordRequest(&tmp)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *Fsyncs) RecordedFsync() fuse.FsyncRequest {
|
||||
val := r.rec.Recorded()
|
||||
if val == nil {
|
||||
return fuse.FsyncRequest{}
|
||||
}
|
||||
return *(val.(*fuse.FsyncRequest))
|
||||
}
|
||||
|
||||
// Mkdirs records a Mkdir request and its fields.
|
||||
type Mkdirs struct {
|
||||
rec RequestRecorder
|
||||
}
|
||||
|
||||
var _ = fs.NodeMkdirer(&Mkdirs{})
|
||||
|
||||
// Mkdir records the request and returns an error. Most callers should
|
||||
// wrap this call in a function that returns a more useful result.
|
||||
func (r *Mkdirs) Mkdir(ctx context.Context, req *fuse.MkdirRequest) (fs.Node, error) {
|
||||
tmp := *req
|
||||
r.rec.RecordRequest(&tmp)
|
||||
return nil, fuse.EIO
|
||||
}
|
||||
|
||||
// RecordedMkdir returns information about the Mkdir request.
|
||||
// If no request was seen, returns a zero value.
|
||||
func (r *Mkdirs) RecordedMkdir() fuse.MkdirRequest {
|
||||
val := r.rec.Recorded()
|
||||
if val == nil {
|
||||
return fuse.MkdirRequest{}
|
||||
}
|
||||
return *(val.(*fuse.MkdirRequest))
|
||||
}
|
||||
|
||||
// Symlinks records a Symlink request and its fields.
|
||||
type Symlinks struct {
|
||||
rec RequestRecorder
|
||||
}
|
||||
|
||||
var _ = fs.NodeSymlinker(&Symlinks{})
|
||||
|
||||
// Symlink records the request and returns an error. Most callers should
|
||||
// wrap this call in a function that returns a more useful result.
|
||||
func (r *Symlinks) Symlink(ctx context.Context, req *fuse.SymlinkRequest) (fs.Node, error) {
|
||||
tmp := *req
|
||||
r.rec.RecordRequest(&tmp)
|
||||
return nil, fuse.EIO
|
||||
}
|
||||
|
||||
// RecordedSymlink returns information about the Symlink request.
|
||||
// If no request was seen, returns a zero value.
|
||||
func (r *Symlinks) RecordedSymlink() fuse.SymlinkRequest {
|
||||
val := r.rec.Recorded()
|
||||
if val == nil {
|
||||
return fuse.SymlinkRequest{}
|
||||
}
|
||||
return *(val.(*fuse.SymlinkRequest))
|
||||
}
|
||||
|
||||
// Links records a Link request and its fields.
|
||||
type Links struct {
|
||||
rec RequestRecorder
|
||||
}
|
||||
|
||||
var _ = fs.NodeLinker(&Links{})
|
||||
|
||||
// Link records the request and returns an error. Most callers should
|
||||
// wrap this call in a function that returns a more useful result.
|
||||
func (r *Links) Link(ctx context.Context, req *fuse.LinkRequest, old fs.Node) (fs.Node, error) {
|
||||
tmp := *req
|
||||
r.rec.RecordRequest(&tmp)
|
||||
return nil, fuse.EIO
|
||||
}
|
||||
|
||||
// RecordedLink returns information about the Link request.
|
||||
// If no request was seen, returns a zero value.
|
||||
func (r *Links) RecordedLink() fuse.LinkRequest {
|
||||
val := r.rec.Recorded()
|
||||
if val == nil {
|
||||
return fuse.LinkRequest{}
|
||||
}
|
||||
return *(val.(*fuse.LinkRequest))
|
||||
}
|
||||
|
||||
// Mknods records a Mknod request and its fields.
|
||||
type Mknods struct {
|
||||
rec RequestRecorder
|
||||
}
|
||||
|
||||
var _ = fs.NodeMknoder(&Mknods{})
|
||||
|
||||
// Mknod records the request and returns an error. Most callers should
|
||||
// wrap this call in a function that returns a more useful result.
|
||||
func (r *Mknods) Mknod(ctx context.Context, req *fuse.MknodRequest) (fs.Node, error) {
|
||||
tmp := *req
|
||||
r.rec.RecordRequest(&tmp)
|
||||
return nil, fuse.EIO
|
||||
}
|
||||
|
||||
// RecordedMknod returns information about the Mknod request.
|
||||
// If no request was seen, returns a zero value.
|
||||
func (r *Mknods) RecordedMknod() fuse.MknodRequest {
|
||||
val := r.rec.Recorded()
|
||||
if val == nil {
|
||||
return fuse.MknodRequest{}
|
||||
}
|
||||
return *(val.(*fuse.MknodRequest))
|
||||
}
|
||||
|
||||
// Opens records a Open request and its fields.
|
||||
type Opens struct {
|
||||
rec RequestRecorder
|
||||
}
|
||||
|
||||
var _ = fs.NodeOpener(&Opens{})
|
||||
|
||||
// Open records the request and returns an error. Most callers should
|
||||
// wrap this call in a function that returns a more useful result.
|
||||
func (r *Opens) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.OpenResponse) (fs.Handle, error) {
|
||||
tmp := *req
|
||||
r.rec.RecordRequest(&tmp)
|
||||
return nil, fuse.EIO
|
||||
}
|
||||
|
||||
// RecordedOpen returns information about the Open request.
|
||||
// If no request was seen, returns a zero value.
|
||||
func (r *Opens) RecordedOpen() fuse.OpenRequest {
|
||||
val := r.rec.Recorded()
|
||||
if val == nil {
|
||||
return fuse.OpenRequest{}
|
||||
}
|
||||
return *(val.(*fuse.OpenRequest))
|
||||
}
|
||||
|
||||
// Getxattrs records a Getxattr request and its fields.
|
||||
type Getxattrs struct {
|
||||
rec RequestRecorder
|
||||
}
|
||||
|
||||
var _ = fs.NodeGetxattrer(&Getxattrs{})
|
||||
|
||||
// Getxattr records the request and returns an error. Most callers should
|
||||
// wrap this call in a function that returns a more useful result.
|
||||
func (r *Getxattrs) Getxattr(ctx context.Context, req *fuse.GetxattrRequest, resp *fuse.GetxattrResponse) error {
|
||||
tmp := *req
|
||||
r.rec.RecordRequest(&tmp)
|
||||
return fuse.ErrNoXattr
|
||||
}
|
||||
|
||||
// RecordedGetxattr returns information about the Getxattr request.
|
||||
// If no request was seen, returns a zero value.
|
||||
func (r *Getxattrs) RecordedGetxattr() fuse.GetxattrRequest {
|
||||
val := r.rec.Recorded()
|
||||
if val == nil {
|
||||
return fuse.GetxattrRequest{}
|
||||
}
|
||||
return *(val.(*fuse.GetxattrRequest))
|
||||
}
|
||||
|
||||
// Listxattrs records a Listxattr request and its fields.
|
||||
type Listxattrs struct {
|
||||
rec RequestRecorder
|
||||
}
|
||||
|
||||
var _ = fs.NodeListxattrer(&Listxattrs{})
|
||||
|
||||
// Listxattr records the request and returns an error. Most callers should
|
||||
// wrap this call in a function that returns a more useful result.
|
||||
func (r *Listxattrs) Listxattr(ctx context.Context, req *fuse.ListxattrRequest, resp *fuse.ListxattrResponse) error {
|
||||
tmp := *req
|
||||
r.rec.RecordRequest(&tmp)
|
||||
return fuse.ErrNoXattr
|
||||
}
|
||||
|
||||
// RecordedListxattr returns information about the Listxattr request.
|
||||
// If no request was seen, returns a zero value.
|
||||
func (r *Listxattrs) RecordedListxattr() fuse.ListxattrRequest {
|
||||
val := r.rec.Recorded()
|
||||
if val == nil {
|
||||
return fuse.ListxattrRequest{}
|
||||
}
|
||||
return *(val.(*fuse.ListxattrRequest))
|
||||
}
|
||||
|
||||
// Setxattrs records a Setxattr request and its fields.
|
||||
type Setxattrs struct {
|
||||
rec RequestRecorder
|
||||
}
|
||||
|
||||
var _ = fs.NodeSetxattrer(&Setxattrs{})
|
||||
|
||||
// Setxattr records the request and returns an error. Most callers should
|
||||
// wrap this call in a function that returns a more useful result.
|
||||
func (r *Setxattrs) Setxattr(ctx context.Context, req *fuse.SetxattrRequest) error {
|
||||
tmp := *req
|
||||
// The byte slice points to memory that will be reused, so make a
|
||||
// deep copy.
|
||||
tmp.Xattr = append([]byte(nil), req.Xattr...)
|
||||
r.rec.RecordRequest(&tmp)
|
||||
return nil
|
||||
}
|
||||
|
||||
// RecordedSetxattr returns information about the Setxattr request.
|
||||
// If no request was seen, returns a zero value.
|
||||
func (r *Setxattrs) RecordedSetxattr() fuse.SetxattrRequest {
|
||||
val := r.rec.Recorded()
|
||||
if val == nil {
|
||||
return fuse.SetxattrRequest{}
|
||||
}
|
||||
return *(val.(*fuse.SetxattrRequest))
|
||||
}
|
||||
|
||||
// Removexattrs records a Removexattr request and its fields.
|
||||
type Removexattrs struct {
|
||||
rec RequestRecorder
|
||||
}
|
||||
|
||||
var _ = fs.NodeRemovexattrer(&Removexattrs{})
|
||||
|
||||
// Removexattr records the request and returns an error. Most callers should
|
||||
// wrap this call in a function that returns a more useful result.
|
||||
func (r *Removexattrs) Removexattr(ctx context.Context, req *fuse.RemovexattrRequest) error {
|
||||
tmp := *req
|
||||
r.rec.RecordRequest(&tmp)
|
||||
return nil
|
||||
}
|
||||
|
||||
// RecordedRemovexattr returns information about the Removexattr request.
|
||||
// If no request was seen, returns a zero value.
|
||||
func (r *Removexattrs) RecordedRemovexattr() fuse.RemovexattrRequest {
|
||||
val := r.rec.Recorded()
|
||||
if val == nil {
|
||||
return fuse.RemovexattrRequest{}
|
||||
}
|
||||
return *(val.(*fuse.RemovexattrRequest))
|
||||
}
|
||||
55
Godeps/_workspace/src/bazil.org/fuse/fs/fstestutil/record/wait.go
generated
vendored
55
Godeps/_workspace/src/bazil.org/fuse/fs/fstestutil/record/wait.go
generated
vendored
@@ -1,55 +0,0 @@
|
||||
package record
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"bazil.org/fuse"
|
||||
"bazil.org/fuse/fs"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
type nothing struct{}
|
||||
|
||||
// ReleaseWaiter notes whether a FUSE Release call has been seen.
|
||||
//
|
||||
// Releases are not guaranteed to happen synchronously with any client
|
||||
// call, so they must be waited for.
|
||||
type ReleaseWaiter struct {
|
||||
once sync.Once
|
||||
seen chan nothing
|
||||
}
|
||||
|
||||
var _ = fs.HandleReleaser(&ReleaseWaiter{})
|
||||
|
||||
func (r *ReleaseWaiter) init() {
|
||||
r.once.Do(func() {
|
||||
r.seen = make(chan nothing, 1)
|
||||
})
|
||||
}
|
||||
|
||||
func (r *ReleaseWaiter) Release(ctx context.Context, req *fuse.ReleaseRequest) error {
|
||||
r.init()
|
||||
close(r.seen)
|
||||
return nil
|
||||
}
|
||||
|
||||
// WaitForRelease waits for Release to be called.
|
||||
//
|
||||
// With zero duration, wait forever. Otherwise, timeout early
|
||||
// in a more controller way than `-test.timeout`.
|
||||
//
|
||||
// Returns whether a Release was seen. Always true if dur==0.
|
||||
func (r *ReleaseWaiter) WaitForRelease(dur time.Duration) bool {
|
||||
r.init()
|
||||
var timeout <-chan time.Time
|
||||
if dur > 0 {
|
||||
timeout = time.After(dur)
|
||||
}
|
||||
select {
|
||||
case <-r.seen:
|
||||
return true
|
||||
case <-timeout:
|
||||
return false
|
||||
}
|
||||
}
|
||||
55
Godeps/_workspace/src/bazil.org/fuse/fs/fstestutil/testfs.go
generated
vendored
55
Godeps/_workspace/src/bazil.org/fuse/fs/fstestutil/testfs.go
generated
vendored
@@ -1,55 +0,0 @@
|
||||
package fstestutil
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"bazil.org/fuse"
|
||||
"bazil.org/fuse/fs"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// SimpleFS is a trivial FS that just implements the Root method.
|
||||
type SimpleFS struct {
|
||||
Node fs.Node
|
||||
}
|
||||
|
||||
var _ = fs.FS(SimpleFS{})
|
||||
|
||||
func (f SimpleFS) Root() (fs.Node, error) {
|
||||
return f.Node, nil
|
||||
}
|
||||
|
||||
// File can be embedded in a struct to make it look like a file.
|
||||
type File struct{}
|
||||
|
||||
func (f File) Attr(ctx context.Context, a *fuse.Attr) error {
|
||||
a.Mode = 0666
|
||||
return nil
|
||||
}
|
||||
|
||||
// Dir can be embedded in a struct to make it look like a directory.
|
||||
type Dir struct{}
|
||||
|
||||
func (f Dir) Attr(ctx context.Context, a *fuse.Attr) error {
|
||||
a.Mode = os.ModeDir | 0777
|
||||
return nil
|
||||
}
|
||||
|
||||
// ChildMap is a directory with child nodes looked up from a map.
|
||||
type ChildMap map[string]fs.Node
|
||||
|
||||
var _ = fs.Node(&ChildMap{})
|
||||
var _ = fs.NodeStringLookuper(&ChildMap{})
|
||||
|
||||
func (f *ChildMap) Attr(ctx context.Context, a *fuse.Attr) error {
|
||||
a.Mode = os.ModeDir | 0777
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f *ChildMap) Lookup(ctx context.Context, name string) (fs.Node, error) {
|
||||
child, ok := (*f)[name]
|
||||
if !ok {
|
||||
return nil, fuse.ENOENT
|
||||
}
|
||||
return child, nil
|
||||
}
|
||||
67
Godeps/_workspace/src/bazil.org/fuse/fs/helpers_test.go
generated
vendored
67
Godeps/_workspace/src/bazil.org/fuse/fs/helpers_test.go
generated
vendored
@@ -1,67 +0,0 @@
|
||||
package fs_test
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"flag"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
|
||||
var childHelpers = map[string]func(){}
|
||||
|
||||
type childProcess struct {
|
||||
name string
|
||||
fn func()
|
||||
}
|
||||
|
||||
var _ flag.Value = (*childProcess)(nil)
|
||||
|
||||
func (c *childProcess) String() string {
|
||||
return c.name
|
||||
}
|
||||
|
||||
func (c *childProcess) Set(s string) error {
|
||||
fn, ok := childHelpers[s]
|
||||
if !ok {
|
||||
return errors.New("helper not found")
|
||||
}
|
||||
c.name = s
|
||||
c.fn = fn
|
||||
return nil
|
||||
}
|
||||
|
||||
var childMode childProcess
|
||||
|
||||
func init() {
|
||||
flag.Var(&childMode, "fuse.internal.child", "internal use only")
|
||||
}
|
||||
|
||||
// childCmd prepares a test function to be run in a subprocess, with
|
||||
// childMode set to true. Caller must still call Run or Start.
|
||||
//
|
||||
// Re-using the test executable as the subprocess is useful because
|
||||
// now test executables can e.g. be cross-compiled, transferred
|
||||
// between hosts, and run in settings where the whole Go development
|
||||
// environment is not installed.
|
||||
func childCmd(childName string) (*exec.Cmd, error) {
|
||||
// caller may set cwd, so we can't rely on relative paths
|
||||
executable, err := filepath.Abs(os.Args[0])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cmd := exec.Command(executable, "-fuse.internal.child="+childName)
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
return cmd, nil
|
||||
}
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
flag.Parse()
|
||||
if childMode.fn != nil {
|
||||
childMode.fn()
|
||||
os.Exit(0)
|
||||
}
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
2403
Godeps/_workspace/src/bazil.org/fuse/fs/serve_test.go
generated
vendored
2403
Godeps/_workspace/src/bazil.org/fuse/fs/serve_test.go
generated
vendored
File diff suppressed because it is too large
Load Diff
31
Godeps/_workspace/src/bazil.org/fuse/fuse_kernel_test.go
generated
vendored
31
Godeps/_workspace/src/bazil.org/fuse/fuse_kernel_test.go
generated
vendored
@@ -1,31 +0,0 @@
|
||||
package fuse_test
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"bazil.org/fuse"
|
||||
)
|
||||
|
||||
func TestOpenFlagsAccmodeMask(t *testing.T) {
|
||||
var f = fuse.OpenFlags(os.O_RDWR | os.O_SYNC)
|
||||
if g, e := f&fuse.OpenAccessModeMask, fuse.OpenReadWrite; g != e {
|
||||
t.Fatalf("OpenAccessModeMask behaves wrong: %v: %o != %o", f, g, e)
|
||||
}
|
||||
if f.IsReadOnly() {
|
||||
t.Fatalf("IsReadOnly is wrong: %v", f)
|
||||
}
|
||||
if f.IsWriteOnly() {
|
||||
t.Fatalf("IsWriteOnly is wrong: %v", f)
|
||||
}
|
||||
if !f.IsReadWrite() {
|
||||
t.Fatalf("IsReadWrite is wrong: %v", f)
|
||||
}
|
||||
}
|
||||
|
||||
func TestOpenFlagsString(t *testing.T) {
|
||||
var f = fuse.OpenFlags(os.O_RDWR | os.O_SYNC | os.O_APPEND)
|
||||
if g, e := f.String(), "OpenReadWrite+OpenAppend+OpenSync"; g != e {
|
||||
t.Fatalf("OpenFlags.String: %q != %q", g, e)
|
||||
}
|
||||
}
|
||||
126
Godeps/_workspace/src/bazil.org/fuse/mount_darwin.go
generated
vendored
126
Godeps/_workspace/src/bazil.org/fuse/mount_darwin.go
generated
vendored
@@ -1,126 +0,0 @@
|
||||
package fuse
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strconv"
|
||||
"strings"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
var errNoAvail = errors.New("no available fuse devices")
|
||||
|
||||
var errNotLoaded = errors.New("osxfusefs is not loaded")
|
||||
|
||||
func loadOSXFUSE() error {
|
||||
cmd := exec.Command("/Library/Filesystems/osxfusefs.fs/Support/load_osxfusefs")
|
||||
cmd.Dir = "/"
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
err := cmd.Run()
|
||||
return err
|
||||
}
|
||||
|
||||
func openOSXFUSEDev() (*os.File, error) {
|
||||
var f *os.File
|
||||
var err error
|
||||
for i := uint64(0); ; i++ {
|
||||
path := "/dev/osxfuse" + strconv.FormatUint(i, 10)
|
||||
f, err = os.OpenFile(path, os.O_RDWR, 0000)
|
||||
if os.IsNotExist(err) {
|
||||
if i == 0 {
|
||||
// not even the first device was found -> fuse is not loaded
|
||||
return nil, errNotLoaded
|
||||
}
|
||||
|
||||
// we've run out of kernel-provided devices
|
||||
return nil, errNoAvail
|
||||
}
|
||||
|
||||
if err2, ok := err.(*os.PathError); ok && err2.Err == syscall.EBUSY {
|
||||
// try the next one
|
||||
continue
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return f, nil
|
||||
}
|
||||
}
|
||||
|
||||
func callMount(dir string, conf *mountConfig, f *os.File, ready chan<- struct{}, errp *error) error {
|
||||
bin := "/Library/Filesystems/osxfusefs.fs/Support/mount_osxfusefs"
|
||||
|
||||
for k, v := range conf.options {
|
||||
if strings.Contains(k, ",") || strings.Contains(v, ",") {
|
||||
// Silly limitation but the mount helper does not
|
||||
// understand any escaping. See TestMountOptionCommaError.
|
||||
return fmt.Errorf("mount options cannot contain commas on darwin: %q=%q", k, v)
|
||||
}
|
||||
}
|
||||
cmd := exec.Command(
|
||||
bin,
|
||||
"-o", conf.getOptions(),
|
||||
// Tell osxfuse-kext how large our buffer is. It must split
|
||||
// writes larger than this into multiple writes.
|
||||
//
|
||||
// OSXFUSE seems to ignore InitResponse.MaxWrite, and uses
|
||||
// this instead.
|
||||
"-o", "iosize="+strconv.FormatUint(maxWrite, 10),
|
||||
// refers to fd passed in cmd.ExtraFiles
|
||||
"3",
|
||||
dir,
|
||||
)
|
||||
cmd.ExtraFiles = []*os.File{f}
|
||||
cmd.Env = os.Environ()
|
||||
cmd.Env = append(cmd.Env, "MOUNT_FUSEFS_CALL_BY_LIB=")
|
||||
// TODO this is used for fs typenames etc, let app influence it
|
||||
cmd.Env = append(cmd.Env, "MOUNT_FUSEFS_DAEMON_PATH="+bin)
|
||||
var buf bytes.Buffer
|
||||
cmd.Stdout = &buf
|
||||
cmd.Stderr = &buf
|
||||
|
||||
err := cmd.Start()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
go func() {
|
||||
err := cmd.Wait()
|
||||
if err != nil {
|
||||
if buf.Len() > 0 {
|
||||
output := buf.Bytes()
|
||||
output = bytes.TrimRight(output, "\n")
|
||||
msg := err.Error() + ": " + string(output)
|
||||
err = errors.New(msg)
|
||||
}
|
||||
}
|
||||
*errp = err
|
||||
close(ready)
|
||||
}()
|
||||
return err
|
||||
}
|
||||
|
||||
func mount(dir string, conf *mountConfig, ready chan<- struct{}, errp *error) (*os.File, error) {
|
||||
f, err := openOSXFUSEDev()
|
||||
if err == errNotLoaded {
|
||||
err = loadOSXFUSE()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// try again
|
||||
f, err = openOSXFUSEDev()
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = callMount(dir, conf, f, ready, errp)
|
||||
if err != nil {
|
||||
f.Close()
|
||||
return nil, err
|
||||
}
|
||||
return f, nil
|
||||
}
|
||||
41
Godeps/_workspace/src/bazil.org/fuse/mount_freebsd.go
generated
vendored
41
Godeps/_workspace/src/bazil.org/fuse/mount_freebsd.go
generated
vendored
@@ -1,41 +0,0 @@
|
||||
package fuse
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func mount(dir string, conf *mountConfig, ready chan<- struct{}, errp *error) (*os.File, error) {
|
||||
for k, v := range conf.options {
|
||||
if strings.Contains(k, ",") || strings.Contains(v, ",") {
|
||||
// Silly limitation but the mount helper does not
|
||||
// understand any escaping. See TestMountOptionCommaError.
|
||||
return nil, fmt.Errorf("mount options cannot contain commas on FreeBSD: %q=%q", k, v)
|
||||
}
|
||||
}
|
||||
|
||||
f, err := os.OpenFile("/dev/fuse", os.O_RDWR, 0000)
|
||||
if err != nil {
|
||||
*errp = err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cmd := exec.Command(
|
||||
"/sbin/mount_fusefs",
|
||||
"--safe",
|
||||
"-o", conf.getOptions(),
|
||||
"3",
|
||||
dir,
|
||||
)
|
||||
cmd.ExtraFiles = []*os.File{f}
|
||||
|
||||
out, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("mount_fusefs: %q, %v", out, err)
|
||||
}
|
||||
|
||||
close(ready)
|
||||
return f, nil
|
||||
}
|
||||
170
Godeps/_workspace/src/bazil.org/fuse/options.go
generated
vendored
170
Godeps/_workspace/src/bazil.org/fuse/options.go
generated
vendored
@@ -1,170 +0,0 @@
|
||||
package fuse
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func dummyOption(conf *mountConfig) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// mountConfig holds the configuration for a mount operation.
|
||||
// Use it by passing MountOption values to Mount.
|
||||
type mountConfig struct {
|
||||
options map[string]string
|
||||
maxReadahead uint32
|
||||
initFlags InitFlags
|
||||
}
|
||||
|
||||
func escapeComma(s string) string {
|
||||
s = strings.Replace(s, `\`, `\\`, -1)
|
||||
s = strings.Replace(s, `,`, `\,`, -1)
|
||||
return s
|
||||
}
|
||||
|
||||
// getOptions makes a string of options suitable for passing to FUSE
|
||||
// mount flag `-o`. Returns an empty string if no options were set.
|
||||
// Any platform specific adjustments should happen before the call.
|
||||
func (m *mountConfig) getOptions() string {
|
||||
var opts []string
|
||||
for k, v := range m.options {
|
||||
k = escapeComma(k)
|
||||
if v != "" {
|
||||
k += "=" + escapeComma(v)
|
||||
}
|
||||
opts = append(opts, k)
|
||||
}
|
||||
return strings.Join(opts, ",")
|
||||
}
|
||||
|
||||
type mountOption func(*mountConfig) error
|
||||
|
||||
// MountOption is passed to Mount to change the behavior of the mount.
|
||||
type MountOption mountOption
|
||||
|
||||
// FSName sets the file system name (also called source) that is
|
||||
// visible in the list of mounted file systems.
|
||||
//
|
||||
// FreeBSD ignores this option.
|
||||
func FSName(name string) MountOption {
|
||||
return func(conf *mountConfig) error {
|
||||
conf.options["fsname"] = name
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// Subtype sets the subtype of the mount. The main type is always
|
||||
// `fuse`. The type in a list of mounted file systems will look like
|
||||
// `fuse.foo`.
|
||||
//
|
||||
// OS X ignores this option.
|
||||
// FreeBSD ignores this option.
|
||||
func Subtype(fstype string) MountOption {
|
||||
return func(conf *mountConfig) error {
|
||||
conf.options["subtype"] = fstype
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// LocalVolume sets the volume to be local (instead of network),
|
||||
// changing the behavior of Finder, Spotlight, and such.
|
||||
//
|
||||
// OS X only. Others ignore this option.
|
||||
func LocalVolume() MountOption {
|
||||
return localVolume
|
||||
}
|
||||
|
||||
// VolumeName sets the volume name shown in Finder.
|
||||
//
|
||||
// OS X only. Others ignore this option.
|
||||
func VolumeName(name string) MountOption {
|
||||
return volumeName(name)
|
||||
}
|
||||
|
||||
var ErrCannotCombineAllowOtherAndAllowRoot = errors.New("cannot combine AllowOther and AllowRoot")
|
||||
|
||||
// AllowOther allows other users to access the file system.
|
||||
//
|
||||
// Only one of AllowOther or AllowRoot can be used.
|
||||
func AllowOther() MountOption {
|
||||
return func(conf *mountConfig) error {
|
||||
if _, ok := conf.options["allow_root"]; ok {
|
||||
return ErrCannotCombineAllowOtherAndAllowRoot
|
||||
}
|
||||
conf.options["allow_other"] = ""
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// AllowRoot allows other users to access the file system.
|
||||
//
|
||||
// Only one of AllowOther or AllowRoot can be used.
|
||||
//
|
||||
// FreeBSD ignores this option.
|
||||
func AllowRoot() MountOption {
|
||||
return func(conf *mountConfig) error {
|
||||
if _, ok := conf.options["allow_other"]; ok {
|
||||
return ErrCannotCombineAllowOtherAndAllowRoot
|
||||
}
|
||||
conf.options["allow_root"] = ""
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// DefaultPermissions makes the kernel enforce access control based on
|
||||
// the file mode (as in chmod).
|
||||
//
|
||||
// Without this option, the Node itself decides what is and is not
|
||||
// allowed. This is normally ok because FUSE file systems cannot be
|
||||
// accessed by other users without AllowOther/AllowRoot.
|
||||
//
|
||||
// FreeBSD ignores this option.
|
||||
func DefaultPermissions() MountOption {
|
||||
return func(conf *mountConfig) error {
|
||||
conf.options["default_permissions"] = ""
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// ReadOnly makes the mount read-only.
|
||||
func ReadOnly() MountOption {
|
||||
return func(conf *mountConfig) error {
|
||||
conf.options["ro"] = ""
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// MaxReadahead sets the number of bytes that can be prefetched for
|
||||
// sequential reads. The kernel can enforce a maximum value lower than
|
||||
// this.
|
||||
//
|
||||
// This setting makes the kernel perform speculative reads that do not
|
||||
// originate from any client process. This usually tremendously
|
||||
// improves read performance.
|
||||
func MaxReadahead(n uint32) MountOption {
|
||||
return func(conf *mountConfig) error {
|
||||
conf.maxReadahead = n
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// AsyncRead enables multiple outstanding read requests for the same
|
||||
// handle. Without this, there is at most one request in flight at a
|
||||
// time.
|
||||
func AsyncRead() MountOption {
|
||||
return func(conf *mountConfig) error {
|
||||
conf.initFlags |= InitAsyncRead
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// WritebackCache enables the kernel to buffer writes before sending
|
||||
// them to the FUSE server. Without this, writethrough caching is
|
||||
// used.
|
||||
func WritebackCache() MountOption {
|
||||
return func(conf *mountConfig) error {
|
||||
conf.initFlags |= InitWritebackCache
|
||||
return nil
|
||||
}
|
||||
}
|
||||
13
Godeps/_workspace/src/bazil.org/fuse/options_darwin.go
generated
vendored
13
Godeps/_workspace/src/bazil.org/fuse/options_darwin.go
generated
vendored
@@ -1,13 +0,0 @@
|
||||
package fuse
|
||||
|
||||
func localVolume(conf *mountConfig) error {
|
||||
conf.options["local"] = ""
|
||||
return nil
|
||||
}
|
||||
|
||||
func volumeName(name string) MountOption {
|
||||
return func(conf *mountConfig) error {
|
||||
conf.options["volname"] = name
|
||||
return nil
|
||||
}
|
||||
}
|
||||
9
Godeps/_workspace/src/bazil.org/fuse/options_freebsd.go
generated
vendored
9
Godeps/_workspace/src/bazil.org/fuse/options_freebsd.go
generated
vendored
@@ -1,9 +0,0 @@
|
||||
package fuse
|
||||
|
||||
func localVolume(conf *mountConfig) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func volumeName(name string) MountOption {
|
||||
return dummyOption
|
||||
}
|
||||
10
Godeps/_workspace/src/bazil.org/fuse/options_helper_test.go
generated
vendored
10
Godeps/_workspace/src/bazil.org/fuse/options_helper_test.go
generated
vendored
@@ -1,10 +0,0 @@
|
||||
package fuse
|
||||
|
||||
// for TestMountOptionCommaError
|
||||
func ForTestSetMountOption(k, v string) MountOption {
|
||||
fn := func(conf *mountConfig) error {
|
||||
conf.options[k] = v
|
||||
return nil
|
||||
}
|
||||
return fn
|
||||
}
|
||||
9
Godeps/_workspace/src/bazil.org/fuse/options_linux.go
generated
vendored
9
Godeps/_workspace/src/bazil.org/fuse/options_linux.go
generated
vendored
@@ -1,9 +0,0 @@
|
||||
package fuse
|
||||
|
||||
func localVolume(conf *mountConfig) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func volumeName(name string) MountOption {
|
||||
return dummyOption
|
||||
}
|
||||
31
Godeps/_workspace/src/bazil.org/fuse/options_nocomma_test.go
generated
vendored
31
Godeps/_workspace/src/bazil.org/fuse/options_nocomma_test.go
generated
vendored
@@ -1,31 +0,0 @@
|
||||
// This file contains tests for platforms that have no escape
|
||||
// mechanism for including commas in mount options.
|
||||
//
|
||||
// +build darwin
|
||||
|
||||
package fuse_test
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"testing"
|
||||
|
||||
"bazil.org/fuse"
|
||||
"bazil.org/fuse/fs/fstestutil"
|
||||
)
|
||||
|
||||
func TestMountOptionCommaError(t *testing.T) {
|
||||
t.Parallel()
|
||||
// this test is not tied to any specific option, it just needs
|
||||
// some string content
|
||||
var evil = "FuseTest,Marker"
|
||||
mnt, err := fstestutil.MountedT(t, fstestutil.SimpleFS{fstestutil.Dir{}}, nil,
|
||||
fuse.ForTestSetMountOption("fusetest", evil),
|
||||
)
|
||||
if err == nil {
|
||||
mnt.Close()
|
||||
t.Fatal("expected an error about commas")
|
||||
}
|
||||
if g, e := err.Error(), `mount options cannot contain commas on `+runtime.GOOS+`: "fusetest"="FuseTest,Marker"`; g != e {
|
||||
t.Fatalf("wrong error: %q != %q", g, e)
|
||||
}
|
||||
}
|
||||
231
Godeps/_workspace/src/bazil.org/fuse/options_test.go
generated
vendored
231
Godeps/_workspace/src/bazil.org/fuse/options_test.go
generated
vendored
@@ -1,231 +0,0 @@
|
||||
package fuse_test
|
||||
|
||||
import (
|
||||
"os"
|
||||
"runtime"
|
||||
"syscall"
|
||||
"testing"
|
||||
|
||||
"bazil.org/fuse"
|
||||
"bazil.org/fuse/fs"
|
||||
"bazil.org/fuse/fs/fstestutil"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
func init() {
|
||||
fstestutil.DebugByDefault()
|
||||
}
|
||||
|
||||
func TestMountOptionFSName(t *testing.T) {
|
||||
if runtime.GOOS == "freebsd" {
|
||||
t.Skip("FreeBSD does not support FSName")
|
||||
}
|
||||
t.Parallel()
|
||||
const name = "FuseTestMarker"
|
||||
mnt, err := fstestutil.MountedT(t, fstestutil.SimpleFS{fstestutil.Dir{}}, nil,
|
||||
fuse.FSName(name),
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer mnt.Close()
|
||||
|
||||
info, err := fstestutil.GetMountInfo(mnt.Dir)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if g, e := info.FSName, name; g != e {
|
||||
t.Errorf("wrong FSName: %q != %q", g, e)
|
||||
}
|
||||
}
|
||||
|
||||
func testMountOptionFSNameEvil(t *testing.T, evil string) {
|
||||
if runtime.GOOS == "freebsd" {
|
||||
t.Skip("FreeBSD does not support FSName")
|
||||
}
|
||||
t.Parallel()
|
||||
var name = "FuseTest" + evil + "Marker"
|
||||
mnt, err := fstestutil.MountedT(t, fstestutil.SimpleFS{fstestutil.Dir{}}, nil,
|
||||
fuse.FSName(name),
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer mnt.Close()
|
||||
|
||||
info, err := fstestutil.GetMountInfo(mnt.Dir)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if g, e := info.FSName, name; g != e {
|
||||
t.Errorf("wrong FSName: %q != %q", g, e)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMountOptionFSNameEvilComma(t *testing.T) {
|
||||
if runtime.GOOS == "darwin" {
|
||||
// see TestMountOptionCommaError for a test that enforces we
|
||||
// at least give a nice error, instead of corrupting the mount
|
||||
// options
|
||||
t.Skip("TODO: OS X gets this wrong, commas in mount options cannot be escaped at all")
|
||||
}
|
||||
testMountOptionFSNameEvil(t, ",")
|
||||
}
|
||||
|
||||
func TestMountOptionFSNameEvilSpace(t *testing.T) {
|
||||
testMountOptionFSNameEvil(t, " ")
|
||||
}
|
||||
|
||||
func TestMountOptionFSNameEvilTab(t *testing.T) {
|
||||
testMountOptionFSNameEvil(t, "\t")
|
||||
}
|
||||
|
||||
func TestMountOptionFSNameEvilNewline(t *testing.T) {
|
||||
testMountOptionFSNameEvil(t, "\n")
|
||||
}
|
||||
|
||||
func TestMountOptionFSNameEvilBackslash(t *testing.T) {
|
||||
testMountOptionFSNameEvil(t, `\`)
|
||||
}
|
||||
|
||||
func TestMountOptionFSNameEvilBackslashDouble(t *testing.T) {
|
||||
// catch double-unescaping, if it were to happen
|
||||
testMountOptionFSNameEvil(t, `\\`)
|
||||
}
|
||||
|
||||
func TestMountOptionSubtype(t *testing.T) {
|
||||
if runtime.GOOS == "darwin" {
|
||||
t.Skip("OS X does not support Subtype")
|
||||
}
|
||||
if runtime.GOOS == "freebsd" {
|
||||
t.Skip("FreeBSD does not support Subtype")
|
||||
}
|
||||
t.Parallel()
|
||||
const name = "FuseTestMarker"
|
||||
mnt, err := fstestutil.MountedT(t, fstestutil.SimpleFS{fstestutil.Dir{}}, nil,
|
||||
fuse.Subtype(name),
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer mnt.Close()
|
||||
|
||||
info, err := fstestutil.GetMountInfo(mnt.Dir)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if g, e := info.Type, "fuse."+name; g != e {
|
||||
t.Errorf("wrong Subtype: %q != %q", g, e)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO test LocalVolume
|
||||
|
||||
// TODO test AllowOther; hard because needs system-level authorization
|
||||
|
||||
func TestMountOptionAllowOtherThenAllowRoot(t *testing.T) {
|
||||
t.Parallel()
|
||||
mnt, err := fstestutil.MountedT(t, fstestutil.SimpleFS{fstestutil.Dir{}}, nil,
|
||||
fuse.AllowOther(),
|
||||
fuse.AllowRoot(),
|
||||
)
|
||||
if err == nil {
|
||||
mnt.Close()
|
||||
}
|
||||
if g, e := err, fuse.ErrCannotCombineAllowOtherAndAllowRoot; g != e {
|
||||
t.Fatalf("wrong error: %v != %v", g, e)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO test AllowRoot; hard because needs system-level authorization
|
||||
|
||||
func TestMountOptionAllowRootThenAllowOther(t *testing.T) {
|
||||
t.Parallel()
|
||||
mnt, err := fstestutil.MountedT(t, fstestutil.SimpleFS{fstestutil.Dir{}}, nil,
|
||||
fuse.AllowRoot(),
|
||||
fuse.AllowOther(),
|
||||
)
|
||||
if err == nil {
|
||||
mnt.Close()
|
||||
}
|
||||
if g, e := err, fuse.ErrCannotCombineAllowOtherAndAllowRoot; g != e {
|
||||
t.Fatalf("wrong error: %v != %v", g, e)
|
||||
}
|
||||
}
|
||||
|
||||
type unwritableFile struct{}
|
||||
|
||||
func (f unwritableFile) Attr(ctx context.Context, a *fuse.Attr) error {
|
||||
a.Mode = 0000
|
||||
return nil
|
||||
}
|
||||
|
||||
func TestMountOptionDefaultPermissions(t *testing.T) {
|
||||
if runtime.GOOS == "freebsd" {
|
||||
t.Skip("FreeBSD does not support DefaultPermissions")
|
||||
}
|
||||
t.Parallel()
|
||||
mnt, err := fstestutil.MountedT(t,
|
||||
fstestutil.SimpleFS{
|
||||
&fstestutil.ChildMap{"child": unwritableFile{}},
|
||||
},
|
||||
nil,
|
||||
fuse.DefaultPermissions(),
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer mnt.Close()
|
||||
|
||||
// This will be prevented by kernel-level access checking when
|
||||
// DefaultPermissions is used.
|
||||
f, err := os.OpenFile(mnt.Dir+"/child", os.O_WRONLY, 0000)
|
||||
if err == nil {
|
||||
f.Close()
|
||||
t.Fatal("expected an error")
|
||||
}
|
||||
if !os.IsPermission(err) {
|
||||
t.Fatalf("expected a permission error, got %T: %v", err, err)
|
||||
}
|
||||
}
|
||||
|
||||
type createrDir struct {
|
||||
fstestutil.Dir
|
||||
}
|
||||
|
||||
var _ fs.NodeCreater = createrDir{}
|
||||
|
||||
func (createrDir) Create(ctx context.Context, req *fuse.CreateRequest, resp *fuse.CreateResponse) (fs.Node, fs.Handle, error) {
|
||||
// pick a really distinct error, to identify it later
|
||||
return nil, nil, fuse.Errno(syscall.ENAMETOOLONG)
|
||||
}
|
||||
|
||||
func TestMountOptionReadOnly(t *testing.T) {
|
||||
t.Parallel()
|
||||
mnt, err := fstestutil.MountedT(t,
|
||||
fstestutil.SimpleFS{createrDir{}},
|
||||
nil,
|
||||
fuse.ReadOnly(),
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer mnt.Close()
|
||||
|
||||
// This will be prevented by kernel-level access checking when
|
||||
// ReadOnly is used.
|
||||
f, err := os.Create(mnt.Dir + "/child")
|
||||
if err == nil {
|
||||
f.Close()
|
||||
t.Fatal("expected an error")
|
||||
}
|
||||
perr, ok := err.(*os.PathError)
|
||||
if !ok {
|
||||
t.Fatalf("expected PathError, got %T: %v", err, err)
|
||||
}
|
||||
if perr.Err != syscall.EROFS {
|
||||
t.Fatalf("expected EROFS, got %T: %v", err, err)
|
||||
}
|
||||
}
|
||||
13
Godeps/_workspace/src/bazil.org/fuse/syscallx/doc.go
generated
vendored
13
Godeps/_workspace/src/bazil.org/fuse/syscallx/doc.go
generated
vendored
@@ -1,13 +0,0 @@
|
||||
// Package syscallx provides wrappers that make syscalls on various
|
||||
// platforms more interoperable.
|
||||
//
|
||||
// The API intentionally omits the OS X-specific position and option
|
||||
// arguments for extended attribute calls.
|
||||
//
|
||||
// Not having position means it might not be useful for accessing the
|
||||
// resource fork. If that's needed by code inside fuse, a function
|
||||
// with a different name may be added on the side.
|
||||
//
|
||||
// Options can be implemented with separate wrappers, in the style of
|
||||
// Linux getxattr/lgetxattr/fgetxattr.
|
||||
package syscallx
|
||||
34
Godeps/_workspace/src/bazil.org/fuse/syscallx/generate
generated
vendored
34
Godeps/_workspace/src/bazil.org/fuse/syscallx/generate
generated
vendored
@@ -1,34 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
mksys="$(go env GOROOT)/src/pkg/syscall/mksyscall.pl"
|
||||
|
||||
fix() {
|
||||
sed 's,^package syscall$,&x\nimport "syscall",' \
|
||||
| gofmt -r='BytePtrFromString -> syscall.BytePtrFromString' \
|
||||
| gofmt -r='Syscall6 -> syscall.Syscall6' \
|
||||
| gofmt -r='Syscall -> syscall.Syscall' \
|
||||
| gofmt -r='SYS_GETXATTR -> syscall.SYS_GETXATTR' \
|
||||
| gofmt -r='SYS_LISTXATTR -> syscall.SYS_LISTXATTR' \
|
||||
| gofmt -r='SYS_SETXATTR -> syscall.SYS_SETXATTR' \
|
||||
| gofmt -r='SYS_REMOVEXATTR -> syscall.SYS_REMOVEXATTR' \
|
||||
| gofmt -r='SYS_MSYNC -> syscall.SYS_MSYNC'
|
||||
}
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
$mksys xattr_darwin.go \
|
||||
| fix \
|
||||
>xattr_darwin_amd64.go
|
||||
|
||||
$mksys -l32 xattr_darwin.go \
|
||||
| fix \
|
||||
>xattr_darwin_386.go
|
||||
|
||||
$mksys msync.go \
|
||||
| fix \
|
||||
>msync_amd64.go
|
||||
|
||||
$mksys -l32 msync.go \
|
||||
| fix \
|
||||
>msync_386.go
|
||||
9
Godeps/_workspace/src/bazil.org/fuse/syscallx/msync.go
generated
vendored
9
Godeps/_workspace/src/bazil.org/fuse/syscallx/msync.go
generated
vendored
@@ -1,9 +0,0 @@
|
||||
package syscallx
|
||||
|
||||
/* This is the source file for msync_*.go, to regenerate run
|
||||
|
||||
./generate
|
||||
|
||||
*/
|
||||
|
||||
//sys Msync(b []byte, flags int) (err error)
|
||||
24
Godeps/_workspace/src/bazil.org/fuse/syscallx/msync_386.go
generated
vendored
24
Godeps/_workspace/src/bazil.org/fuse/syscallx/msync_386.go
generated
vendored
@@ -1,24 +0,0 @@
|
||||
// mksyscall.pl -l32 msync.go
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
|
||||
package syscallx
|
||||
|
||||
import "syscall"
|
||||
|
||||
import "unsafe"
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Msync(b []byte, flags int) (err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(b) > 0 {
|
||||
_p0 = unsafe.Pointer(&b[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
_, _, e1 := syscall.Syscall(syscall.SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags))
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
24
Godeps/_workspace/src/bazil.org/fuse/syscallx/msync_amd64.go
generated
vendored
24
Godeps/_workspace/src/bazil.org/fuse/syscallx/msync_amd64.go
generated
vendored
@@ -1,24 +0,0 @@
|
||||
// mksyscall.pl msync.go
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
|
||||
package syscallx
|
||||
|
||||
import "syscall"
|
||||
|
||||
import "unsafe"
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Msync(b []byte, flags int) (err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(b) > 0 {
|
||||
_p0 = unsafe.Pointer(&b[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
_, _, e1 := syscall.Syscall(syscall.SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags))
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
4
Godeps/_workspace/src/bazil.org/fuse/syscallx/syscallx.go
generated
vendored
4
Godeps/_workspace/src/bazil.org/fuse/syscallx/syscallx.go
generated
vendored
@@ -1,4 +0,0 @@
|
||||
package syscallx
|
||||
|
||||
// make us look more like package syscall, so mksyscall.pl output works
|
||||
var _zero uintptr
|
||||
26
Godeps/_workspace/src/bazil.org/fuse/syscallx/syscallx_std.go
generated
vendored
26
Godeps/_workspace/src/bazil.org/fuse/syscallx/syscallx_std.go
generated
vendored
@@ -1,26 +0,0 @@
|
||||
// +build !darwin
|
||||
|
||||
package syscallx
|
||||
|
||||
// This file just contains wrappers for platforms that already have
|
||||
// the right stuff in golang.org/x/sys/unix.
|
||||
|
||||
import (
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
func Getxattr(path string, attr string, dest []byte) (sz int, err error) {
|
||||
return unix.Getxattr(path, attr, dest)
|
||||
}
|
||||
|
||||
func Listxattr(path string, dest []byte) (sz int, err error) {
|
||||
return unix.Listxattr(path, dest)
|
||||
}
|
||||
|
||||
func Setxattr(path string, attr string, data []byte, flags int) (err error) {
|
||||
return unix.Setxattr(path, attr, data, flags)
|
||||
}
|
||||
|
||||
func Removexattr(path string, attr string) (err error) {
|
||||
return unix.Removexattr(path, attr)
|
||||
}
|
||||
38
Godeps/_workspace/src/bazil.org/fuse/syscallx/xattr_darwin.go
generated
vendored
38
Godeps/_workspace/src/bazil.org/fuse/syscallx/xattr_darwin.go
generated
vendored
@@ -1,38 +0,0 @@
|
||||
package syscallx
|
||||
|
||||
/* This is the source file for syscallx_darwin_*.go, to regenerate run
|
||||
|
||||
./generate
|
||||
|
||||
*/
|
||||
|
||||
// cannot use dest []byte here because OS X getxattr really wants a
|
||||
// NULL to trigger size probing, size==0 is not enough
|
||||
//
|
||||
//sys getxattr(path string, attr string, dest *byte, size int, position uint32, options int) (sz int, err error)
|
||||
|
||||
func Getxattr(path string, attr string, dest []byte) (sz int, err error) {
|
||||
var destp *byte
|
||||
if len(dest) > 0 {
|
||||
destp = &dest[0]
|
||||
}
|
||||
return getxattr(path, attr, destp, len(dest), 0, 0)
|
||||
}
|
||||
|
||||
//sys listxattr(path string, dest []byte, options int) (sz int, err error)
|
||||
|
||||
func Listxattr(path string, dest []byte) (sz int, err error) {
|
||||
return listxattr(path, dest, 0)
|
||||
}
|
||||
|
||||
//sys setxattr(path string, attr string, data []byte, position uint32, flags int) (err error)
|
||||
|
||||
func Setxattr(path string, attr string, data []byte, flags int) (err error) {
|
||||
return setxattr(path, attr, data, 0, flags)
|
||||
}
|
||||
|
||||
//sys removexattr(path string, attr string, options int) (err error)
|
||||
|
||||
func Removexattr(path string, attr string) (err error) {
|
||||
return removexattr(path, attr, 0)
|
||||
}
|
||||
97
Godeps/_workspace/src/bazil.org/fuse/syscallx/xattr_darwin_386.go
generated
vendored
97
Godeps/_workspace/src/bazil.org/fuse/syscallx/xattr_darwin_386.go
generated
vendored
@@ -1,97 +0,0 @@
|
||||
// mksyscall.pl -l32 xattr_darwin.go
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
|
||||
package syscallx
|
||||
|
||||
import "syscall"
|
||||
|
||||
import "unsafe"
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func getxattr(path string, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = syscall.BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = syscall.BytePtrFromString(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
r0, _, e1 := syscall.Syscall6(syscall.SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options))
|
||||
sz = int(r0)
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func listxattr(path string, dest []byte, options int) (sz int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = syscall.BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 unsafe.Pointer
|
||||
if len(dest) > 0 {
|
||||
_p1 = unsafe.Pointer(&dest[0])
|
||||
} else {
|
||||
_p1 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := syscall.Syscall6(syscall.SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest)), uintptr(options), 0, 0)
|
||||
sz = int(r0)
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func setxattr(path string, attr string, data []byte, position uint32, flags int) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = syscall.BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = syscall.BytePtrFromString(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 unsafe.Pointer
|
||||
if len(data) > 0 {
|
||||
_p2 = unsafe.Pointer(&data[0])
|
||||
} else {
|
||||
_p2 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
_, _, e1 := syscall.Syscall6(syscall.SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(position), uintptr(flags))
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func removexattr(path string, attr string, options int) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = syscall.BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = syscall.BytePtrFromString(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
_, _, e1 := syscall.Syscall(syscall.SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options))
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
97
Godeps/_workspace/src/bazil.org/fuse/syscallx/xattr_darwin_amd64.go
generated
vendored
97
Godeps/_workspace/src/bazil.org/fuse/syscallx/xattr_darwin_amd64.go
generated
vendored
@@ -1,97 +0,0 @@
|
||||
// mksyscall.pl xattr_darwin.go
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
|
||||
package syscallx
|
||||
|
||||
import "syscall"
|
||||
|
||||
import "unsafe"
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func getxattr(path string, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = syscall.BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = syscall.BytePtrFromString(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
r0, _, e1 := syscall.Syscall6(syscall.SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options))
|
||||
sz = int(r0)
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func listxattr(path string, dest []byte, options int) (sz int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = syscall.BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 unsafe.Pointer
|
||||
if len(dest) > 0 {
|
||||
_p1 = unsafe.Pointer(&dest[0])
|
||||
} else {
|
||||
_p1 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := syscall.Syscall6(syscall.SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest)), uintptr(options), 0, 0)
|
||||
sz = int(r0)
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func setxattr(path string, attr string, data []byte, position uint32, flags int) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = syscall.BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = syscall.BytePtrFromString(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 unsafe.Pointer
|
||||
if len(data) > 0 {
|
||||
_p2 = unsafe.Pointer(&data[0])
|
||||
} else {
|
||||
_p2 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
_, _, e1 := syscall.Syscall6(syscall.SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(position), uintptr(flags))
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func removexattr(path string, attr string, options int) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = syscall.BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = syscall.BytePtrFromString(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
_, _, e1 := syscall.Syscall(syscall.SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options))
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
35
Godeps/_workspace/src/github.com/jessevdk/go-flags/.travis.yml
generated
vendored
35
Godeps/_workspace/src/github.com/jessevdk/go-flags/.travis.yml
generated
vendored
@@ -1,35 +0,0 @@
|
||||
language: go
|
||||
|
||||
install:
|
||||
# go-flags
|
||||
- go get -d -v ./...
|
||||
- go build -v ./...
|
||||
|
||||
# linting
|
||||
- go get golang.org/x/tools/cmd/vet
|
||||
- go get github.com/golang/lint
|
||||
- go install github.com/golang/lint/golint
|
||||
|
||||
# code coverage
|
||||
- go get golang.org/x/tools/cmd/cover
|
||||
- go get github.com/onsi/ginkgo/ginkgo
|
||||
- go get github.com/modocache/gover
|
||||
- if [ "$TRAVIS_SECURE_ENV_VARS" = "true" ]; then go get github.com/mattn/goveralls; fi
|
||||
|
||||
script:
|
||||
# go-flags
|
||||
- $(exit $(gofmt -l . | wc -l))
|
||||
- go test -v ./...
|
||||
|
||||
# linting
|
||||
- go tool vet -all=true -v=true . || true
|
||||
- $(go env GOPATH | awk 'BEGIN{FS=":"} {print $1}')/bin/golint ./...
|
||||
|
||||
# code coverage
|
||||
- $(go env GOPATH | awk 'BEGIN{FS=":"} {print $1}')/bin/ginkgo -r -cover
|
||||
- $(go env GOPATH | awk 'BEGIN{FS=":"} {print $1}')/bin/gover
|
||||
- if [ "$TRAVIS_SECURE_ENV_VARS" = "true" ]; then $(go env GOPATH | awk 'BEGIN{FS=":"} {print $1}')/bin/goveralls -coverprofile=gover.coverprofile -service=travis-ci -repotoken $COVERALLS_TOKEN; fi
|
||||
|
||||
env:
|
||||
# coveralls.io
|
||||
secure: "RCYbiB4P0RjQRIoUx/vG/AjP3mmYCbzOmr86DCww1Z88yNcy3hYr3Cq8rpPtYU5v0g7wTpu4adaKIcqRE9xknYGbqj3YWZiCoBP1/n4Z+9sHW3Dsd9D/GRGeHUus0laJUGARjWoCTvoEtOgTdGQDoX7mH+pUUY0FBltNYUdOiiU="
|
||||
131
Godeps/_workspace/src/github.com/jessevdk/go-flags/README.md
generated
vendored
131
Godeps/_workspace/src/github.com/jessevdk/go-flags/README.md
generated
vendored
@@ -1,131 +0,0 @@
|
||||
go-flags: a go library for parsing command line arguments
|
||||
=========================================================
|
||||
|
||||
[](https://godoc.org/github.com/jessevdk/go-flags) [](https://travis-ci.org/jessevdk/go-flags) [](https://coveralls.io/r/jessevdk/go-flags?branch=master)
|
||||
|
||||
This library provides similar functionality to the builtin flag library of
|
||||
go, but provides much more functionality and nicer formatting. From the
|
||||
documentation:
|
||||
|
||||
Package flags provides an extensive command line option parser.
|
||||
The flags package is similar in functionality to the go builtin flag package
|
||||
but provides more options and uses reflection to provide a convenient and
|
||||
succinct way of specifying command line options.
|
||||
|
||||
Supported features:
|
||||
* Options with short names (-v)
|
||||
* Options with long names (--verbose)
|
||||
* Options with and without arguments (bool v.s. other type)
|
||||
* Options with optional arguments and default values
|
||||
* Multiple option groups each containing a set of options
|
||||
* Generate and print well-formatted help message
|
||||
* Passing remaining command line arguments after -- (optional)
|
||||
* Ignoring unknown command line options (optional)
|
||||
* Supports -I/usr/include -I=/usr/include -I /usr/include option argument specification
|
||||
* Supports multiple short options -aux
|
||||
* Supports all primitive go types (string, int{8..64}, uint{8..64}, float)
|
||||
* Supports same option multiple times (can store in slice or last option counts)
|
||||
* Supports maps
|
||||
* Supports function callbacks
|
||||
* Supports namespaces for (nested) option groups
|
||||
|
||||
The flags package uses structs, reflection and struct field tags
|
||||
to allow users to specify command line options. This results in very simple
|
||||
and concise specification of your application options. For example:
|
||||
|
||||
type Options struct {
|
||||
Verbose []bool `short:"v" long:"verbose" description:"Show verbose debug information"`
|
||||
}
|
||||
|
||||
This specifies one option with a short name -v and a long name --verbose.
|
||||
When either -v or --verbose is found on the command line, a 'true' value
|
||||
will be appended to the Verbose field. e.g. when specifying -vvv, the
|
||||
resulting value of Verbose will be {[true, true, true]}.
|
||||
|
||||
Example:
|
||||
--------
|
||||
var opts struct {
|
||||
// Slice of bool will append 'true' each time the option
|
||||
// is encountered (can be set multiple times, like -vvv)
|
||||
Verbose []bool `short:"v" long:"verbose" description:"Show verbose debug information"`
|
||||
|
||||
// Example of automatic marshalling to desired type (uint)
|
||||
Offset uint `long:"offset" description:"Offset"`
|
||||
|
||||
// Example of a callback, called each time the option is found.
|
||||
Call func(string) `short:"c" description:"Call phone number"`
|
||||
|
||||
// Example of a required flag
|
||||
Name string `short:"n" long:"name" description:"A name" required:"true"`
|
||||
|
||||
// Example of a value name
|
||||
File string `short:"f" long:"file" description:"A file" value-name:"FILE"`
|
||||
|
||||
// Example of a pointer
|
||||
Ptr *int `short:"p" description:"A pointer to an integer"`
|
||||
|
||||
// Example of a slice of strings
|
||||
StringSlice []string `short:"s" description:"A slice of strings"`
|
||||
|
||||
// Example of a slice of pointers
|
||||
PtrSlice []*string `long:"ptrslice" description:"A slice of pointers to string"`
|
||||
|
||||
// Example of a map
|
||||
IntMap map[string]int `long:"intmap" description:"A map from string to int"`
|
||||
}
|
||||
|
||||
// Callback which will invoke callto:<argument> to call a number.
|
||||
// Note that this works just on OS X (and probably only with
|
||||
// Skype) but it shows the idea.
|
||||
opts.Call = func(num string) {
|
||||
cmd := exec.Command("open", "callto:"+num)
|
||||
cmd.Start()
|
||||
cmd.Process.Release()
|
||||
}
|
||||
|
||||
// Make some fake arguments to parse.
|
||||
args := []string{
|
||||
"-vv",
|
||||
"--offset=5",
|
||||
"-n", "Me",
|
||||
"-p", "3",
|
||||
"-s", "hello",
|
||||
"-s", "world",
|
||||
"--ptrslice", "hello",
|
||||
"--ptrslice", "world",
|
||||
"--intmap", "a:1",
|
||||
"--intmap", "b:5",
|
||||
"arg1",
|
||||
"arg2",
|
||||
"arg3",
|
||||
}
|
||||
|
||||
// Parse flags from `args'. Note that here we use flags.ParseArgs for
|
||||
// the sake of making a working example. Normally, you would simply use
|
||||
// flags.Parse(&opts) which uses os.Args
|
||||
args, err := flags.ParseArgs(&opts, args)
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
fmt.Printf("Verbosity: %v\n", opts.Verbose)
|
||||
fmt.Printf("Offset: %d\n", opts.Offset)
|
||||
fmt.Printf("Name: %s\n", opts.Name)
|
||||
fmt.Printf("Ptr: %d\n", *opts.Ptr)
|
||||
fmt.Printf("StringSlice: %v\n", opts.StringSlice)
|
||||
fmt.Printf("PtrSlice: [%v %v]\n", *opts.PtrSlice[0], *opts.PtrSlice[1])
|
||||
fmt.Printf("IntMap: [a:%v b:%v]\n", opts.IntMap["a"], opts.IntMap["b"])
|
||||
fmt.Printf("Remaining args: %s\n", strings.Join(args, " "))
|
||||
|
||||
// Output: Verbosity: [true true]
|
||||
// Offset: 5
|
||||
// Name: Me
|
||||
// Ptr: 3
|
||||
// StringSlice: [hello world]
|
||||
// PtrSlice: [hello world]
|
||||
// IntMap: [a:1 b:5]
|
||||
// Remaining args: arg1 arg2 arg3
|
||||
|
||||
More information can be found in the godocs: <http://godoc.org/github.com/jessevdk/go-flags>
|
||||
21
Godeps/_workspace/src/github.com/jessevdk/go-flags/arg.go
generated
vendored
21
Godeps/_workspace/src/github.com/jessevdk/go-flags/arg.go
generated
vendored
@@ -1,21 +0,0 @@
|
||||
package flags
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
)
|
||||
|
||||
// Arg represents a positional argument on the command line.
|
||||
type Arg struct {
|
||||
// The name of the positional argument (used in the help)
|
||||
Name string
|
||||
|
||||
// A description of the positional argument (used in the help)
|
||||
Description string
|
||||
|
||||
value reflect.Value
|
||||
tag multiTag
|
||||
}
|
||||
|
||||
func (a *Arg) isRemaining() bool {
|
||||
return a.value.Type().Kind() == reflect.Slice
|
||||
}
|
||||
53
Godeps/_workspace/src/github.com/jessevdk/go-flags/arg_test.go
generated
vendored
53
Godeps/_workspace/src/github.com/jessevdk/go-flags/arg_test.go
generated
vendored
@@ -1,53 +0,0 @@
|
||||
package flags
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestPositional(t *testing.T) {
|
||||
var opts = struct {
|
||||
Value bool `short:"v"`
|
||||
|
||||
Positional struct {
|
||||
Command int
|
||||
Filename string
|
||||
Rest []string
|
||||
} `positional-args:"yes" required:"yes"`
|
||||
}{}
|
||||
|
||||
p := NewParser(&opts, Default)
|
||||
ret, err := p.ParseArgs([]string{"10", "arg_test.go", "a", "b"})
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
if opts.Positional.Command != 10 {
|
||||
t.Fatalf("Expected opts.Positional.Command to be 10, but got %v", opts.Positional.Command)
|
||||
}
|
||||
|
||||
if opts.Positional.Filename != "arg_test.go" {
|
||||
t.Fatalf("Expected opts.Positional.Filename to be \"arg_test.go\", but got %v", opts.Positional.Filename)
|
||||
}
|
||||
|
||||
assertStringArray(t, opts.Positional.Rest, []string{"a", "b"})
|
||||
assertStringArray(t, ret, []string{})
|
||||
}
|
||||
|
||||
func TestPositionalRequired(t *testing.T) {
|
||||
var opts = struct {
|
||||
Value bool `short:"v"`
|
||||
|
||||
Positional struct {
|
||||
Command int
|
||||
Filename string
|
||||
Rest []string
|
||||
} `positional-args:"yes" required:"yes"`
|
||||
}{}
|
||||
|
||||
p := NewParser(&opts, None)
|
||||
_, err := p.ParseArgs([]string{"10"})
|
||||
|
||||
assertError(t, err, ErrRequired, "the required argument `Filename` was not provided")
|
||||
}
|
||||
177
Godeps/_workspace/src/github.com/jessevdk/go-flags/assert_test.go
generated
vendored
177
Godeps/_workspace/src/github.com/jessevdk/go-flags/assert_test.go
generated
vendored
@@ -1,177 +0,0 @@
|
||||
package flags
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
"runtime"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func assertCallerInfo() (string, int) {
|
||||
ptr := make([]uintptr, 15)
|
||||
n := runtime.Callers(1, ptr)
|
||||
|
||||
if n == 0 {
|
||||
return "", 0
|
||||
}
|
||||
|
||||
mef := runtime.FuncForPC(ptr[0])
|
||||
mefile, meline := mef.FileLine(ptr[0])
|
||||
|
||||
for i := 2; i < n; i++ {
|
||||
f := runtime.FuncForPC(ptr[i])
|
||||
file, line := f.FileLine(ptr[i])
|
||||
|
||||
if file != mefile {
|
||||
return file, line
|
||||
}
|
||||
}
|
||||
|
||||
return mefile, meline
|
||||
}
|
||||
|
||||
func assertErrorf(t *testing.T, format string, args ...interface{}) {
|
||||
msg := fmt.Sprintf(format, args...)
|
||||
|
||||
file, line := assertCallerInfo()
|
||||
|
||||
t.Errorf("%s:%d: %s", path.Base(file), line, msg)
|
||||
}
|
||||
|
||||
func assertFatalf(t *testing.T, format string, args ...interface{}) {
|
||||
msg := fmt.Sprintf(format, args...)
|
||||
|
||||
file, line := assertCallerInfo()
|
||||
|
||||
t.Fatalf("%s:%d: %s", path.Base(file), line, msg)
|
||||
}
|
||||
|
||||
func assertString(t *testing.T, a string, b string) {
|
||||
if a != b {
|
||||
assertErrorf(t, "Expected %#v, but got %#v", b, a)
|
||||
}
|
||||
}
|
||||
|
||||
func assertStringArray(t *testing.T, a []string, b []string) {
|
||||
if len(a) != len(b) {
|
||||
assertErrorf(t, "Expected %#v, but got %#v", b, a)
|
||||
return
|
||||
}
|
||||
|
||||
for i, v := range a {
|
||||
if b[i] != v {
|
||||
assertErrorf(t, "Expected %#v, but got %#v", b, a)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func assertBoolArray(t *testing.T, a []bool, b []bool) {
|
||||
if len(a) != len(b) {
|
||||
assertErrorf(t, "Expected %#v, but got %#v", b, a)
|
||||
return
|
||||
}
|
||||
|
||||
for i, v := range a {
|
||||
if b[i] != v {
|
||||
assertErrorf(t, "Expected %#v, but got %#v", b, a)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func assertParserSuccess(t *testing.T, data interface{}, args ...string) (*Parser, []string) {
|
||||
parser := NewParser(data, Default&^PrintErrors)
|
||||
ret, err := parser.ParseArgs(args)
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected parse error: %s", err)
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
return parser, ret
|
||||
}
|
||||
|
||||
func assertParseSuccess(t *testing.T, data interface{}, args ...string) []string {
|
||||
_, ret := assertParserSuccess(t, data, args...)
|
||||
return ret
|
||||
}
|
||||
|
||||
func assertError(t *testing.T, err error, typ ErrorType, msg string) {
|
||||
if err == nil {
|
||||
assertFatalf(t, "Expected error: %s", msg)
|
||||
return
|
||||
}
|
||||
|
||||
if e, ok := err.(*Error); !ok {
|
||||
assertFatalf(t, "Expected Error type, but got %#v", err)
|
||||
} else {
|
||||
if e.Type != typ {
|
||||
assertErrorf(t, "Expected error type {%s}, but got {%s}", typ, e.Type)
|
||||
}
|
||||
|
||||
if e.Message != msg {
|
||||
assertErrorf(t, "Expected error message %#v, but got %#v", msg, e.Message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func assertParseFail(t *testing.T, typ ErrorType, msg string, data interface{}, args ...string) []string {
|
||||
parser := NewParser(data, Default&^PrintErrors)
|
||||
ret, err := parser.ParseArgs(args)
|
||||
|
||||
assertError(t, err, typ, msg)
|
||||
return ret
|
||||
}
|
||||
|
||||
func diff(a, b string) (string, error) {
|
||||
atmp, err := ioutil.TempFile("", "help-diff")
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
btmp, err := ioutil.TempFile("", "help-diff")
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if _, err := io.WriteString(atmp, a); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if _, err := io.WriteString(btmp, b); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
ret, err := exec.Command("diff", "-u", "-d", "--label", "got", atmp.Name(), "--label", "expected", btmp.Name()).Output()
|
||||
|
||||
os.Remove(atmp.Name())
|
||||
os.Remove(btmp.Name())
|
||||
|
||||
if err.Error() == "exit status 1" {
|
||||
return string(ret), nil
|
||||
}
|
||||
|
||||
return string(ret), err
|
||||
}
|
||||
|
||||
func assertDiff(t *testing.T, actual, expected, msg string) {
|
||||
if actual == expected {
|
||||
return
|
||||
}
|
||||
|
||||
ret, err := diff(actual, expected)
|
||||
|
||||
if err != nil {
|
||||
assertErrorf(t, "Unexpected diff error: %s", err)
|
||||
assertErrorf(t, "Unexpected %s, expected:\n\n%s\n\nbut got\n\n%s", msg, expected, actual)
|
||||
} else {
|
||||
assertErrorf(t, "Unexpected %s:\n\n%s", msg, ret)
|
||||
}
|
||||
}
|
||||
16
Godeps/_workspace/src/github.com/jessevdk/go-flags/check_crosscompile.sh
generated
vendored
16
Godeps/_workspace/src/github.com/jessevdk/go-flags/check_crosscompile.sh
generated
vendored
@@ -1,16 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
echo '# linux arm7'
|
||||
GOARM=7 GOARCH=arm GOOS=linux go build
|
||||
echo '# linux arm5'
|
||||
GOARM=5 GOARCH=arm GOOS=linux go build
|
||||
echo '# windows 386'
|
||||
GOARCH=386 GOOS=windows go build
|
||||
echo '# windows amd64'
|
||||
GOARCH=amd64 GOOS=windows go build
|
||||
echo '# darwin'
|
||||
GOARCH=amd64 GOOS=darwin go build
|
||||
echo '# freebsd'
|
||||
GOARCH=amd64 GOOS=freebsd go build
|
||||
59
Godeps/_workspace/src/github.com/jessevdk/go-flags/closest.go
generated
vendored
59
Godeps/_workspace/src/github.com/jessevdk/go-flags/closest.go
generated
vendored
@@ -1,59 +0,0 @@
|
||||
package flags
|
||||
|
||||
func levenshtein(s string, t string) int {
|
||||
if len(s) == 0 {
|
||||
return len(t)
|
||||
}
|
||||
|
||||
if len(t) == 0 {
|
||||
return len(s)
|
||||
}
|
||||
|
||||
dists := make([][]int, len(s)+1)
|
||||
for i := range dists {
|
||||
dists[i] = make([]int, len(t)+1)
|
||||
dists[i][0] = i
|
||||
}
|
||||
|
||||
for j := range t {
|
||||
dists[0][j] = j
|
||||
}
|
||||
|
||||
for i, sc := range s {
|
||||
for j, tc := range t {
|
||||
if sc == tc {
|
||||
dists[i+1][j+1] = dists[i][j]
|
||||
} else {
|
||||
dists[i+1][j+1] = dists[i][j] + 1
|
||||
if dists[i+1][j] < dists[i+1][j+1] {
|
||||
dists[i+1][j+1] = dists[i+1][j] + 1
|
||||
}
|
||||
if dists[i][j+1] < dists[i+1][j+1] {
|
||||
dists[i+1][j+1] = dists[i][j+1] + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return dists[len(s)][len(t)]
|
||||
}
|
||||
|
||||
func closestChoice(cmd string, choices []string) (string, int) {
|
||||
if len(choices) == 0 {
|
||||
return "", 0
|
||||
}
|
||||
|
||||
mincmd := -1
|
||||
mindist := -1
|
||||
|
||||
for i, c := range choices {
|
||||
l := levenshtein(cmd, c)
|
||||
|
||||
if mincmd < 0 || l < mindist {
|
||||
mindist = l
|
||||
mincmd = i
|
||||
}
|
||||
}
|
||||
|
||||
return choices[mincmd], mindist
|
||||
}
|
||||
106
Godeps/_workspace/src/github.com/jessevdk/go-flags/command.go
generated
vendored
106
Godeps/_workspace/src/github.com/jessevdk/go-flags/command.go
generated
vendored
@@ -1,106 +0,0 @@
|
||||
package flags
|
||||
|
||||
// Command represents an application command. Commands can be added to the
|
||||
// parser (which itself is a command) and are selected/executed when its name
|
||||
// is specified on the command line. The Command type embeds a Group and
|
||||
// therefore also carries a set of command specific options.
|
||||
type Command struct {
|
||||
// Embedded, see Group for more information
|
||||
*Group
|
||||
|
||||
// The name by which the command can be invoked
|
||||
Name string
|
||||
|
||||
// The active sub command (set by parsing) or nil
|
||||
Active *Command
|
||||
|
||||
// Whether subcommands are optional
|
||||
SubcommandsOptional bool
|
||||
|
||||
// Aliases for the command
|
||||
Aliases []string
|
||||
|
||||
// Whether positional arguments are required
|
||||
ArgsRequired bool
|
||||
|
||||
commands []*Command
|
||||
hasBuiltinHelpGroup bool
|
||||
args []*Arg
|
||||
}
|
||||
|
||||
// Commander is an interface which can be implemented by any command added in
|
||||
// the options. When implemented, the Execute method will be called for the last
|
||||
// specified (sub)command providing the remaining command line arguments.
|
||||
type Commander interface {
|
||||
// Execute will be called for the last active (sub)command. The
|
||||
// args argument contains the remaining command line arguments. The
|
||||
// error that Execute returns will be eventually passed out of the
|
||||
// Parse method of the Parser.
|
||||
Execute(args []string) error
|
||||
}
|
||||
|
||||
// Usage is an interface which can be implemented to show a custom usage string
|
||||
// in the help message shown for a command.
|
||||
type Usage interface {
|
||||
// Usage is called for commands to allow customized printing of command
|
||||
// usage in the generated help message.
|
||||
Usage() string
|
||||
}
|
||||
|
||||
// AddCommand adds a new command to the parser with the given name and data. The
|
||||
// data needs to be a pointer to a struct from which the fields indicate which
|
||||
// options are in the command. The provided data can implement the Command and
|
||||
// Usage interfaces.
|
||||
func (c *Command) AddCommand(command string, shortDescription string, longDescription string, data interface{}) (*Command, error) {
|
||||
cmd := newCommand(command, shortDescription, longDescription, data)
|
||||
|
||||
cmd.parent = c
|
||||
|
||||
if err := cmd.scan(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
c.commands = append(c.commands, cmd)
|
||||
return cmd, nil
|
||||
}
|
||||
|
||||
// AddGroup adds a new group to the command with the given name and data. The
|
||||
// data needs to be a pointer to a struct from which the fields indicate which
|
||||
// options are in the group.
|
||||
func (c *Command) AddGroup(shortDescription string, longDescription string, data interface{}) (*Group, error) {
|
||||
group := newGroup(shortDescription, longDescription, data)
|
||||
|
||||
group.parent = c
|
||||
|
||||
if err := group.scanType(c.scanSubcommandHandler(group)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
c.groups = append(c.groups, group)
|
||||
return group, nil
|
||||
}
|
||||
|
||||
// Commands returns a list of subcommands of this command.
|
||||
func (c *Command) Commands() []*Command {
|
||||
return c.commands
|
||||
}
|
||||
|
||||
// Find locates the subcommand with the given name and returns it. If no such
|
||||
// command can be found Find will return nil.
|
||||
func (c *Command) Find(name string) *Command {
|
||||
for _, cc := range c.commands {
|
||||
if cc.match(name) {
|
||||
return cc
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Args returns a list of positional arguments associated with this command.
|
||||
func (c *Command) Args() []*Arg {
|
||||
ret := make([]*Arg, len(c.args))
|
||||
copy(ret, c.args)
|
||||
|
||||
return ret
|
||||
}
|
||||
271
Godeps/_workspace/src/github.com/jessevdk/go-flags/command_private.go
generated
vendored
271
Godeps/_workspace/src/github.com/jessevdk/go-flags/command_private.go
generated
vendored
@@ -1,271 +0,0 @@
|
||||
package flags
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"sort"
|
||||
"strings"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
type lookup struct {
|
||||
shortNames map[string]*Option
|
||||
longNames map[string]*Option
|
||||
|
||||
commands map[string]*Command
|
||||
}
|
||||
|
||||
func newCommand(name string, shortDescription string, longDescription string, data interface{}) *Command {
|
||||
return &Command{
|
||||
Group: newGroup(shortDescription, longDescription, data),
|
||||
Name: name,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Command) scanSubcommandHandler(parentg *Group) scanHandler {
|
||||
f := func(realval reflect.Value, sfield *reflect.StructField) (bool, error) {
|
||||
mtag := newMultiTag(string(sfield.Tag))
|
||||
|
||||
if err := mtag.Parse(); err != nil {
|
||||
return true, err
|
||||
}
|
||||
|
||||
positional := mtag.Get("positional-args")
|
||||
|
||||
if len(positional) != 0 {
|
||||
stype := realval.Type()
|
||||
|
||||
for i := 0; i < stype.NumField(); i++ {
|
||||
field := stype.Field(i)
|
||||
|
||||
m := newMultiTag((string(field.Tag)))
|
||||
|
||||
if err := m.Parse(); err != nil {
|
||||
return true, err
|
||||
}
|
||||
|
||||
name := m.Get("positional-arg-name")
|
||||
|
||||
if len(name) == 0 {
|
||||
name = field.Name
|
||||
}
|
||||
|
||||
arg := &Arg{
|
||||
Name: name,
|
||||
Description: m.Get("description"),
|
||||
|
||||
value: realval.Field(i),
|
||||
tag: m,
|
||||
}
|
||||
|
||||
c.args = append(c.args, arg)
|
||||
|
||||
if len(mtag.Get("required")) != 0 {
|
||||
c.ArgsRequired = true
|
||||
}
|
||||
}
|
||||
|
||||
return true, nil
|
||||
}
|
||||
|
||||
subcommand := mtag.Get("command")
|
||||
|
||||
if len(subcommand) != 0 {
|
||||
ptrval := reflect.NewAt(realval.Type(), unsafe.Pointer(realval.UnsafeAddr()))
|
||||
|
||||
shortDescription := mtag.Get("description")
|
||||
longDescription := mtag.Get("long-description")
|
||||
subcommandsOptional := mtag.Get("subcommands-optional")
|
||||
aliases := mtag.GetMany("alias")
|
||||
|
||||
subc, err := c.AddCommand(subcommand, shortDescription, longDescription, ptrval.Interface())
|
||||
|
||||
if err != nil {
|
||||
return true, err
|
||||
}
|
||||
|
||||
if len(subcommandsOptional) > 0 {
|
||||
subc.SubcommandsOptional = true
|
||||
}
|
||||
|
||||
if len(aliases) > 0 {
|
||||
subc.Aliases = aliases
|
||||
}
|
||||
|
||||
return true, nil
|
||||
}
|
||||
|
||||
return parentg.scanSubGroupHandler(realval, sfield)
|
||||
}
|
||||
|
||||
return f
|
||||
}
|
||||
|
||||
func (c *Command) scan() error {
|
||||
return c.scanType(c.scanSubcommandHandler(c.Group))
|
||||
}
|
||||
|
||||
func (c *Command) eachCommand(f func(*Command), recurse bool) {
|
||||
f(c)
|
||||
|
||||
for _, cc := range c.commands {
|
||||
if recurse {
|
||||
cc.eachCommand(f, true)
|
||||
} else {
|
||||
f(cc)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Command) eachActiveGroup(f func(cc *Command, g *Group)) {
|
||||
c.eachGroup(func(g *Group) {
|
||||
f(c, g)
|
||||
})
|
||||
|
||||
if c.Active != nil {
|
||||
c.Active.eachActiveGroup(f)
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Command) addHelpGroups(showHelp func() error) {
|
||||
if !c.hasBuiltinHelpGroup {
|
||||
c.addHelpGroup(showHelp)
|
||||
c.hasBuiltinHelpGroup = true
|
||||
}
|
||||
|
||||
for _, cc := range c.commands {
|
||||
cc.addHelpGroups(showHelp)
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Command) makeLookup() lookup {
|
||||
ret := lookup{
|
||||
shortNames: make(map[string]*Option),
|
||||
longNames: make(map[string]*Option),
|
||||
commands: make(map[string]*Command),
|
||||
}
|
||||
|
||||
parent := c.parent
|
||||
|
||||
for parent != nil {
|
||||
if cmd, ok := parent.(*Command); ok {
|
||||
cmd.fillLookup(&ret, true)
|
||||
}
|
||||
|
||||
if grp, ok := parent.(*Group); ok {
|
||||
parent = grp
|
||||
} else {
|
||||
parent = nil
|
||||
}
|
||||
}
|
||||
|
||||
c.fillLookup(&ret, false)
|
||||
return ret
|
||||
}
|
||||
|
||||
func (c *Command) fillLookup(ret *lookup, onlyOptions bool) {
|
||||
c.eachGroup(func(g *Group) {
|
||||
for _, option := range g.options {
|
||||
if option.ShortName != 0 {
|
||||
ret.shortNames[string(option.ShortName)] = option
|
||||
}
|
||||
|
||||
if len(option.LongName) > 0 {
|
||||
ret.longNames[option.LongNameWithNamespace()] = option
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
if onlyOptions {
|
||||
return
|
||||
}
|
||||
|
||||
for _, subcommand := range c.commands {
|
||||
ret.commands[subcommand.Name] = subcommand
|
||||
|
||||
for _, a := range subcommand.Aliases {
|
||||
ret.commands[a] = subcommand
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Command) groupByName(name string) *Group {
|
||||
if grp := c.Group.groupByName(name); grp != nil {
|
||||
return grp
|
||||
}
|
||||
|
||||
for _, subc := range c.commands {
|
||||
prefix := subc.Name + "."
|
||||
|
||||
if strings.HasPrefix(name, prefix) {
|
||||
if grp := subc.groupByName(name[len(prefix):]); grp != nil {
|
||||
return grp
|
||||
}
|
||||
} else if name == subc.Name {
|
||||
return subc.Group
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type commandList []*Command
|
||||
|
||||
func (c commandList) Less(i, j int) bool {
|
||||
return c[i].Name < c[j].Name
|
||||
}
|
||||
|
||||
func (c commandList) Len() int {
|
||||
return len(c)
|
||||
}
|
||||
|
||||
func (c commandList) Swap(i, j int) {
|
||||
c[i], c[j] = c[j], c[i]
|
||||
}
|
||||
|
||||
func (c *Command) sortedCommands() []*Command {
|
||||
ret := make(commandList, len(c.commands))
|
||||
copy(ret, c.commands)
|
||||
|
||||
sort.Sort(ret)
|
||||
return []*Command(ret)
|
||||
}
|
||||
|
||||
func (c *Command) match(name string) bool {
|
||||
if c.Name == name {
|
||||
return true
|
||||
}
|
||||
|
||||
for _, v := range c.Aliases {
|
||||
if v == name {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func (c *Command) hasCliOptions() bool {
|
||||
ret := false
|
||||
|
||||
c.eachGroup(func(g *Group) {
|
||||
if g.isBuiltinHelp {
|
||||
return
|
||||
}
|
||||
|
||||
for _, opt := range g.options {
|
||||
if opt.canCli() {
|
||||
ret = true
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
func (c *Command) fillParseState(s *parseState) {
|
||||
s.positional = make([]*Arg, len(c.args))
|
||||
copy(s.positional, c.args)
|
||||
|
||||
s.lookup = c.makeLookup()
|
||||
s.command = c
|
||||
}
|
||||
402
Godeps/_workspace/src/github.com/jessevdk/go-flags/command_test.go
generated
vendored
402
Godeps/_workspace/src/github.com/jessevdk/go-flags/command_test.go
generated
vendored
@@ -1,402 +0,0 @@
|
||||
package flags
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestCommandInline(t *testing.T) {
|
||||
var opts = struct {
|
||||
Value bool `short:"v"`
|
||||
|
||||
Command struct {
|
||||
G bool `short:"g"`
|
||||
} `command:"cmd"`
|
||||
}{}
|
||||
|
||||
p, ret := assertParserSuccess(t, &opts, "-v", "cmd", "-g")
|
||||
|
||||
assertStringArray(t, ret, []string{})
|
||||
|
||||
if p.Active == nil {
|
||||
t.Errorf("Expected active command")
|
||||
}
|
||||
|
||||
if !opts.Value {
|
||||
t.Errorf("Expected Value to be true")
|
||||
}
|
||||
|
||||
if !opts.Command.G {
|
||||
t.Errorf("Expected Command.G to be true")
|
||||
}
|
||||
|
||||
if p.Command.Find("cmd") != p.Active {
|
||||
t.Errorf("Expected to find command `cmd' to be active")
|
||||
}
|
||||
}
|
||||
|
||||
func TestCommandInlineMulti(t *testing.T) {
|
||||
var opts = struct {
|
||||
Value bool `short:"v"`
|
||||
|
||||
C1 struct {
|
||||
} `command:"c1"`
|
||||
|
||||
C2 struct {
|
||||
G bool `short:"g"`
|
||||
} `command:"c2"`
|
||||
}{}
|
||||
|
||||
p, ret := assertParserSuccess(t, &opts, "-v", "c2", "-g")
|
||||
|
||||
assertStringArray(t, ret, []string{})
|
||||
|
||||
if p.Active == nil {
|
||||
t.Errorf("Expected active command")
|
||||
}
|
||||
|
||||
if !opts.Value {
|
||||
t.Errorf("Expected Value to be true")
|
||||
}
|
||||
|
||||
if !opts.C2.G {
|
||||
t.Errorf("Expected C2.G to be true")
|
||||
}
|
||||
|
||||
if p.Command.Find("c1") == nil {
|
||||
t.Errorf("Expected to find command `c1'")
|
||||
}
|
||||
|
||||
if c2 := p.Command.Find("c2"); c2 == nil {
|
||||
t.Errorf("Expected to find command `c2'")
|
||||
} else if c2 != p.Active {
|
||||
t.Errorf("Expected to find command `c2' to be active")
|
||||
}
|
||||
}
|
||||
|
||||
func TestCommandFlagOrder1(t *testing.T) {
|
||||
var opts = struct {
|
||||
Value bool `short:"v"`
|
||||
|
||||
Command struct {
|
||||
G bool `short:"g"`
|
||||
} `command:"cmd"`
|
||||
}{}
|
||||
|
||||
assertParseFail(t, ErrUnknownFlag, "unknown flag `g'", &opts, "-v", "-g", "cmd")
|
||||
}
|
||||
|
||||
func TestCommandFlagOrder2(t *testing.T) {
|
||||
var opts = struct {
|
||||
Value bool `short:"v"`
|
||||
|
||||
Command struct {
|
||||
G bool `short:"g"`
|
||||
} `command:"cmd"`
|
||||
}{}
|
||||
|
||||
assertParseSuccess(t, &opts, "cmd", "-v", "-g")
|
||||
|
||||
if !opts.Value {
|
||||
t.Errorf("Expected Value to be true")
|
||||
}
|
||||
|
||||
if !opts.Command.G {
|
||||
t.Errorf("Expected Command.G to be true")
|
||||
}
|
||||
}
|
||||
|
||||
func TestCommandFlagOverride1(t *testing.T) {
|
||||
var opts = struct {
|
||||
Value bool `short:"v"`
|
||||
|
||||
Command struct {
|
||||
Value bool `short:"v"`
|
||||
} `command:"cmd"`
|
||||
}{}
|
||||
|
||||
assertParseSuccess(t, &opts, "-v", "cmd")
|
||||
|
||||
if !opts.Value {
|
||||
t.Errorf("Expected Value to be true")
|
||||
}
|
||||
|
||||
if opts.Command.Value {
|
||||
t.Errorf("Expected Command.Value to be false")
|
||||
}
|
||||
}
|
||||
|
||||
func TestCommandFlagOverride2(t *testing.T) {
|
||||
var opts = struct {
|
||||
Value bool `short:"v"`
|
||||
|
||||
Command struct {
|
||||
Value bool `short:"v"`
|
||||
} `command:"cmd"`
|
||||
}{}
|
||||
|
||||
assertParseSuccess(t, &opts, "cmd", "-v")
|
||||
|
||||
if opts.Value {
|
||||
t.Errorf("Expected Value to be false")
|
||||
}
|
||||
|
||||
if !opts.Command.Value {
|
||||
t.Errorf("Expected Command.Value to be true")
|
||||
}
|
||||
}
|
||||
|
||||
func TestCommandEstimate(t *testing.T) {
|
||||
var opts = struct {
|
||||
Value bool `short:"v"`
|
||||
|
||||
Cmd1 struct {
|
||||
} `command:"remove"`
|
||||
|
||||
Cmd2 struct {
|
||||
} `command:"add"`
|
||||
}{}
|
||||
|
||||
p := NewParser(&opts, None)
|
||||
_, err := p.ParseArgs([]string{})
|
||||
|
||||
assertError(t, err, ErrCommandRequired, "Please specify one command of: add or remove")
|
||||
}
|
||||
|
||||
func TestCommandEstimate2(t *testing.T) {
|
||||
var opts = struct {
|
||||
Value bool `short:"v"`
|
||||
|
||||
Cmd1 struct {
|
||||
} `command:"remove"`
|
||||
|
||||
Cmd2 struct {
|
||||
} `command:"add"`
|
||||
}{}
|
||||
|
||||
p := NewParser(&opts, None)
|
||||
_, err := p.ParseArgs([]string{"rmive"})
|
||||
|
||||
assertError(t, err, ErrUnknownCommand, "Unknown command `rmive', did you mean `remove'?")
|
||||
}
|
||||
|
||||
type testCommand struct {
|
||||
G bool `short:"g"`
|
||||
Executed bool
|
||||
EArgs []string
|
||||
}
|
||||
|
||||
func (c *testCommand) Execute(args []string) error {
|
||||
c.Executed = true
|
||||
c.EArgs = args
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func TestCommandExecute(t *testing.T) {
|
||||
var opts = struct {
|
||||
Value bool `short:"v"`
|
||||
|
||||
Command testCommand `command:"cmd"`
|
||||
}{}
|
||||
|
||||
assertParseSuccess(t, &opts, "-v", "cmd", "-g", "a", "b")
|
||||
|
||||
if !opts.Value {
|
||||
t.Errorf("Expected Value to be true")
|
||||
}
|
||||
|
||||
if !opts.Command.Executed {
|
||||
t.Errorf("Did not execute command")
|
||||
}
|
||||
|
||||
if !opts.Command.G {
|
||||
t.Errorf("Expected Command.C to be true")
|
||||
}
|
||||
|
||||
assertStringArray(t, opts.Command.EArgs, []string{"a", "b"})
|
||||
}
|
||||
|
||||
func TestCommandClosest(t *testing.T) {
|
||||
var opts = struct {
|
||||
Value bool `short:"v"`
|
||||
|
||||
Cmd1 struct {
|
||||
} `command:"remove"`
|
||||
|
||||
Cmd2 struct {
|
||||
} `command:"add"`
|
||||
}{}
|
||||
|
||||
args := assertParseFail(t, ErrUnknownCommand, "Unknown command `addd', did you mean `add'?", &opts, "-v", "addd")
|
||||
|
||||
assertStringArray(t, args, []string{"addd"})
|
||||
}
|
||||
|
||||
func TestCommandAdd(t *testing.T) {
|
||||
var opts = struct {
|
||||
Value bool `short:"v"`
|
||||
}{}
|
||||
|
||||
var cmd = struct {
|
||||
G bool `short:"g"`
|
||||
}{}
|
||||
|
||||
p := NewParser(&opts, Default)
|
||||
c, err := p.AddCommand("cmd", "", "", &cmd)
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
ret, err := p.ParseArgs([]string{"-v", "cmd", "-g", "rest"})
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
assertStringArray(t, ret, []string{"rest"})
|
||||
|
||||
if !opts.Value {
|
||||
t.Errorf("Expected Value to be true")
|
||||
}
|
||||
|
||||
if !cmd.G {
|
||||
t.Errorf("Expected Command.G to be true")
|
||||
}
|
||||
|
||||
if p.Command.Find("cmd") != c {
|
||||
t.Errorf("Expected to find command `cmd'")
|
||||
}
|
||||
|
||||
if p.Commands()[0] != c {
|
||||
t.Errorf("Expected command %#v, but got %#v", c, p.Commands()[0])
|
||||
}
|
||||
|
||||
if c.Options()[0].ShortName != 'g' {
|
||||
t.Errorf("Expected short name `g' but got %v", c.Options()[0].ShortName)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCommandNestedInline(t *testing.T) {
|
||||
var opts = struct {
|
||||
Value bool `short:"v"`
|
||||
|
||||
Command struct {
|
||||
G bool `short:"g"`
|
||||
|
||||
Nested struct {
|
||||
N string `long:"n"`
|
||||
} `command:"nested"`
|
||||
} `command:"cmd"`
|
||||
}{}
|
||||
|
||||
p, ret := assertParserSuccess(t, &opts, "-v", "cmd", "-g", "nested", "--n", "n", "rest")
|
||||
|
||||
assertStringArray(t, ret, []string{"rest"})
|
||||
|
||||
if !opts.Value {
|
||||
t.Errorf("Expected Value to be true")
|
||||
}
|
||||
|
||||
if !opts.Command.G {
|
||||
t.Errorf("Expected Command.G to be true")
|
||||
}
|
||||
|
||||
assertString(t, opts.Command.Nested.N, "n")
|
||||
|
||||
if c := p.Command.Find("cmd"); c == nil {
|
||||
t.Errorf("Expected to find command `cmd'")
|
||||
} else {
|
||||
if c != p.Active {
|
||||
t.Errorf("Expected `cmd' to be the active parser command")
|
||||
}
|
||||
|
||||
if nested := c.Find("nested"); nested == nil {
|
||||
t.Errorf("Expected to find command `nested'")
|
||||
} else if nested != c.Active {
|
||||
t.Errorf("Expected to find command `nested' to be the active `cmd' command")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestRequiredOnCommand(t *testing.T) {
|
||||
var opts = struct {
|
||||
Value bool `short:"v" required:"true"`
|
||||
|
||||
Command struct {
|
||||
G bool `short:"g"`
|
||||
} `command:"cmd"`
|
||||
}{}
|
||||
|
||||
assertParseFail(t, ErrRequired, fmt.Sprintf("the required flag `%cv' was not specified", defaultShortOptDelimiter), &opts, "cmd")
|
||||
}
|
||||
|
||||
func TestRequiredAllOnCommand(t *testing.T) {
|
||||
var opts = struct {
|
||||
Value bool `short:"v" required:"true"`
|
||||
Missing bool `long:"missing" required:"true"`
|
||||
|
||||
Command struct {
|
||||
G bool `short:"g"`
|
||||
} `command:"cmd"`
|
||||
}{}
|
||||
|
||||
assertParseFail(t, ErrRequired, fmt.Sprintf("the required flags `%smissing' and `%cv' were not specified", defaultLongOptDelimiter, defaultShortOptDelimiter), &opts, "cmd")
|
||||
}
|
||||
|
||||
func TestDefaultOnCommand(t *testing.T) {
|
||||
var opts = struct {
|
||||
Command struct {
|
||||
G bool `short:"g" default:"true"`
|
||||
} `command:"cmd"`
|
||||
}{}
|
||||
|
||||
assertParseSuccess(t, &opts, "cmd")
|
||||
|
||||
if !opts.Command.G {
|
||||
t.Errorf("Expected G to be true")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSubcommandsOptional(t *testing.T) {
|
||||
var opts = struct {
|
||||
Value bool `short:"v"`
|
||||
|
||||
Cmd1 struct {
|
||||
} `command:"remove"`
|
||||
|
||||
Cmd2 struct {
|
||||
} `command:"add"`
|
||||
}{}
|
||||
|
||||
p := NewParser(&opts, None)
|
||||
p.SubcommandsOptional = true
|
||||
|
||||
_, err := p.ParseArgs([]string{"-v"})
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
if !opts.Value {
|
||||
t.Errorf("Expected Value to be true")
|
||||
}
|
||||
}
|
||||
|
||||
func TestCommandAlias(t *testing.T) {
|
||||
var opts = struct {
|
||||
Command struct {
|
||||
G bool `short:"g" default:"true"`
|
||||
} `command:"cmd" alias:"cm"`
|
||||
}{}
|
||||
|
||||
assertParseSuccess(t, &opts, "cm")
|
||||
|
||||
if !opts.Command.G {
|
||||
t.Errorf("Expected G to be true")
|
||||
}
|
||||
}
|
||||
304
Godeps/_workspace/src/github.com/jessevdk/go-flags/completion.go
generated
vendored
304
Godeps/_workspace/src/github.com/jessevdk/go-flags/completion.go
generated
vendored
@@ -1,304 +0,0 @@
|
||||
package flags
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"sort"
|
||||
"strings"
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
||||
// Completion is a type containing information of a completion.
|
||||
type Completion struct {
|
||||
// The completed item
|
||||
Item string
|
||||
|
||||
// A description of the completed item (optional)
|
||||
Description string
|
||||
}
|
||||
|
||||
type completions []Completion
|
||||
|
||||
func (c completions) Len() int {
|
||||
return len(c)
|
||||
}
|
||||
|
||||
func (c completions) Less(i, j int) bool {
|
||||
return c[i].Item < c[j].Item
|
||||
}
|
||||
|
||||
func (c completions) Swap(i, j int) {
|
||||
c[i], c[j] = c[j], c[i]
|
||||
}
|
||||
|
||||
// Completer is an interface which can be implemented by types
|
||||
// to provide custom command line argument completion.
|
||||
type Completer interface {
|
||||
// Complete receives a prefix representing a (partial) value
|
||||
// for its type and should provide a list of possible valid
|
||||
// completions.
|
||||
Complete(match string) []Completion
|
||||
}
|
||||
|
||||
type completion struct {
|
||||
parser *Parser
|
||||
|
||||
ShowDescriptions bool
|
||||
}
|
||||
|
||||
// Filename is a string alias which provides filename completion.
|
||||
type Filename string
|
||||
|
||||
func completionsWithoutDescriptions(items []string) []Completion {
|
||||
ret := make([]Completion, len(items))
|
||||
|
||||
for i, v := range items {
|
||||
ret[i].Item = v
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
// Complete returns a list of existing files with the given
|
||||
// prefix.
|
||||
func (f *Filename) Complete(match string) []Completion {
|
||||
ret, _ := filepath.Glob(match + "*")
|
||||
return completionsWithoutDescriptions(ret)
|
||||
}
|
||||
|
||||
func (c *completion) skipPositional(s *parseState, n int) {
|
||||
if n >= len(s.positional) {
|
||||
s.positional = nil
|
||||
} else {
|
||||
s.positional = s.positional[n:]
|
||||
}
|
||||
}
|
||||
|
||||
func (c *completion) completeOptionNames(names map[string]*Option, prefix string, match string) []Completion {
|
||||
n := make([]Completion, 0, len(names))
|
||||
|
||||
for k, opt := range names {
|
||||
if strings.HasPrefix(k, match) {
|
||||
n = append(n, Completion{
|
||||
Item: prefix + k,
|
||||
Description: opt.Description,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return n
|
||||
}
|
||||
|
||||
func (c *completion) completeLongNames(s *parseState, prefix string, match string) []Completion {
|
||||
return c.completeOptionNames(s.lookup.longNames, prefix, match)
|
||||
}
|
||||
|
||||
func (c *completion) completeShortNames(s *parseState, prefix string, match string) []Completion {
|
||||
if len(match) != 0 {
|
||||
return []Completion{
|
||||
Completion{
|
||||
Item: prefix + match,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
return c.completeOptionNames(s.lookup.shortNames, prefix, match)
|
||||
}
|
||||
|
||||
func (c *completion) completeCommands(s *parseState, match string) []Completion {
|
||||
n := make([]Completion, 0, len(s.command.commands))
|
||||
|
||||
for _, cmd := range s.command.commands {
|
||||
if cmd.data != c && strings.HasPrefix(cmd.Name, match) {
|
||||
n = append(n, Completion{
|
||||
Item: cmd.Name,
|
||||
Description: cmd.ShortDescription,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return n
|
||||
}
|
||||
|
||||
func (c *completion) completeValue(value reflect.Value, prefix string, match string) []Completion {
|
||||
i := value.Interface()
|
||||
|
||||
var ret []Completion
|
||||
|
||||
if cmp, ok := i.(Completer); ok {
|
||||
ret = cmp.Complete(match)
|
||||
} else if value.CanAddr() {
|
||||
if cmp, ok = value.Addr().Interface().(Completer); ok {
|
||||
ret = cmp.Complete(match)
|
||||
}
|
||||
}
|
||||
|
||||
for i, v := range ret {
|
||||
ret[i].Item = prefix + v.Item
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
func (c *completion) completeArg(arg *Arg, prefix string, match string) []Completion {
|
||||
if arg.isRemaining() {
|
||||
// For remaining positional args (that are parsed into a slice), complete
|
||||
// based on the element type.
|
||||
return c.completeValue(reflect.New(arg.value.Type().Elem()), prefix, match)
|
||||
}
|
||||
|
||||
return c.completeValue(arg.value, prefix, match)
|
||||
}
|
||||
|
||||
func (c *completion) complete(args []string) []Completion {
|
||||
if len(args) == 0 {
|
||||
args = []string{""}
|
||||
}
|
||||
|
||||
s := &parseState{
|
||||
args: args,
|
||||
}
|
||||
|
||||
c.parser.fillParseState(s)
|
||||
|
||||
var opt *Option
|
||||
|
||||
for len(s.args) > 1 {
|
||||
arg := s.pop()
|
||||
|
||||
if (c.parser.Options&PassDoubleDash) != None && arg == "--" {
|
||||
opt = nil
|
||||
c.skipPositional(s, len(s.args)-1)
|
||||
|
||||
break
|
||||
}
|
||||
|
||||
if argumentIsOption(arg) {
|
||||
prefix, optname, islong := stripOptionPrefix(arg)
|
||||
optname, _, argument := splitOption(prefix, optname, islong)
|
||||
|
||||
if argument == nil {
|
||||
var o *Option
|
||||
canarg := true
|
||||
|
||||
if islong {
|
||||
o = s.lookup.longNames[optname]
|
||||
} else {
|
||||
for i, r := range optname {
|
||||
sname := string(r)
|
||||
o = s.lookup.shortNames[sname]
|
||||
|
||||
if o == nil {
|
||||
break
|
||||
}
|
||||
|
||||
if i == 0 && o.canArgument() && len(optname) != len(sname) {
|
||||
canarg = false
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if o == nil && (c.parser.Options&PassAfterNonOption) != None {
|
||||
opt = nil
|
||||
c.skipPositional(s, len(s.args)-1)
|
||||
|
||||
break
|
||||
} else if o != nil && o.canArgument() && !o.OptionalArgument && canarg {
|
||||
if len(s.args) > 1 {
|
||||
s.pop()
|
||||
} else {
|
||||
opt = o
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if len(s.positional) > 0 {
|
||||
if !s.positional[0].isRemaining() {
|
||||
// Don't advance beyond a remaining positional arg (because
|
||||
// it consumes all subsequent args).
|
||||
s.positional = s.positional[1:]
|
||||
}
|
||||
} else if cmd, ok := s.lookup.commands[arg]; ok {
|
||||
cmd.fillParseState(s)
|
||||
}
|
||||
|
||||
opt = nil
|
||||
}
|
||||
}
|
||||
|
||||
lastarg := s.args[len(s.args)-1]
|
||||
var ret []Completion
|
||||
|
||||
if opt != nil {
|
||||
// Completion for the argument of 'opt'
|
||||
ret = c.completeValue(opt.value, "", lastarg)
|
||||
} else if argumentStartsOption(lastarg) {
|
||||
// Complete the option
|
||||
prefix, optname, islong := stripOptionPrefix(lastarg)
|
||||
optname, split, argument := splitOption(prefix, optname, islong)
|
||||
|
||||
if argument == nil && !islong {
|
||||
rname, n := utf8.DecodeRuneInString(optname)
|
||||
sname := string(rname)
|
||||
|
||||
if opt := s.lookup.shortNames[sname]; opt != nil && opt.canArgument() {
|
||||
ret = c.completeValue(opt.value, prefix+sname, optname[n:])
|
||||
} else {
|
||||
ret = c.completeShortNames(s, prefix, optname)
|
||||
}
|
||||
} else if argument != nil {
|
||||
if islong {
|
||||
opt = s.lookup.longNames[optname]
|
||||
} else {
|
||||
opt = s.lookup.shortNames[optname]
|
||||
}
|
||||
|
||||
if opt != nil {
|
||||
ret = c.completeValue(opt.value, prefix+optname+split, *argument)
|
||||
}
|
||||
} else if islong {
|
||||
ret = c.completeLongNames(s, prefix, optname)
|
||||
} else {
|
||||
ret = c.completeShortNames(s, prefix, optname)
|
||||
}
|
||||
} else if len(s.positional) > 0 {
|
||||
// Complete for positional argument
|
||||
ret = c.completeArg(s.positional[0], "", lastarg)
|
||||
} else if len(s.command.commands) > 0 {
|
||||
// Complete for command
|
||||
ret = c.completeCommands(s, lastarg)
|
||||
}
|
||||
|
||||
sort.Sort(completions(ret))
|
||||
return ret
|
||||
}
|
||||
|
||||
func (c *completion) execute(args []string) {
|
||||
ret := c.complete(args)
|
||||
|
||||
if c.ShowDescriptions && len(ret) > 1 {
|
||||
maxl := 0
|
||||
|
||||
for _, v := range ret {
|
||||
if len(v.Item) > maxl {
|
||||
maxl = len(v.Item)
|
||||
}
|
||||
}
|
||||
|
||||
for _, v := range ret {
|
||||
fmt.Printf("%s", v.Item)
|
||||
|
||||
if len(v.Description) > 0 {
|
||||
fmt.Printf("%s # %s", strings.Repeat(" ", maxl-len(v.Item)), v.Description)
|
||||
}
|
||||
|
||||
fmt.Printf("\n")
|
||||
}
|
||||
} else {
|
||||
for _, v := range ret {
|
||||
fmt.Println(v.Item)
|
||||
}
|
||||
}
|
||||
}
|
||||
289
Godeps/_workspace/src/github.com/jessevdk/go-flags/completion_test.go
generated
vendored
289
Godeps/_workspace/src/github.com/jessevdk/go-flags/completion_test.go
generated
vendored
@@ -1,289 +0,0 @@
|
||||
package flags
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"runtime"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
type TestComplete struct {
|
||||
}
|
||||
|
||||
func (t *TestComplete) Complete(match string) []Completion {
|
||||
options := []string{
|
||||
"hello world",
|
||||
"hello universe",
|
||||
"hello multiverse",
|
||||
}
|
||||
|
||||
ret := make([]Completion, 0, len(options))
|
||||
|
||||
for _, o := range options {
|
||||
if strings.HasPrefix(o, match) {
|
||||
ret = append(ret, Completion{
|
||||
Item: o,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
var completionTestOptions struct {
|
||||
Verbose bool `short:"v" long:"verbose" description:"Verbose messages"`
|
||||
Debug bool `short:"d" long:"debug" description:"Enable debug"`
|
||||
Version bool `long:"version" description:"Show version"`
|
||||
Required bool `long:"required" required:"true" description:"This is required"`
|
||||
|
||||
AddCommand struct {
|
||||
Positional struct {
|
||||
Filename Filename
|
||||
} `positional-args:"yes"`
|
||||
} `command:"add" description:"add an item"`
|
||||
|
||||
AddMultiCommand struct {
|
||||
Positional struct {
|
||||
Filename []Filename
|
||||
} `positional-args:"yes"`
|
||||
} `command:"add-multi" description:"add multiple items"`
|
||||
|
||||
RemoveCommand struct {
|
||||
Other bool `short:"o"`
|
||||
File Filename `short:"f" long:"filename"`
|
||||
} `command:"rm" description:"remove an item"`
|
||||
|
||||
RenameCommand struct {
|
||||
Completed TestComplete `short:"c" long:"completed"`
|
||||
} `command:"rename" description:"rename an item"`
|
||||
}
|
||||
|
||||
type completionTest struct {
|
||||
Args []string
|
||||
Completed []string
|
||||
ShowDescriptions bool
|
||||
}
|
||||
|
||||
var completionTests []completionTest
|
||||
|
||||
func init() {
|
||||
_, sourcefile, _, _ := runtime.Caller(0)
|
||||
completionTestSourcedir := filepath.Join(filepath.SplitList(path.Dir(sourcefile))...)
|
||||
|
||||
completionTestFilename := []string{filepath.Join(completionTestSourcedir, "completion.go"), filepath.Join(completionTestSourcedir, "completion_test.go")}
|
||||
|
||||
completionTests = []completionTest{
|
||||
{
|
||||
// Short names
|
||||
[]string{"-"},
|
||||
[]string{"-d", "-v"},
|
||||
false,
|
||||
},
|
||||
|
||||
{
|
||||
// Short names concatenated
|
||||
[]string{"-dv"},
|
||||
[]string{"-dv"},
|
||||
false,
|
||||
},
|
||||
|
||||
{
|
||||
// Long names
|
||||
[]string{"--"},
|
||||
[]string{"--debug", "--required", "--verbose", "--version"},
|
||||
false,
|
||||
},
|
||||
|
||||
{
|
||||
// Long names with descriptions
|
||||
[]string{"--"},
|
||||
[]string{
|
||||
"--debug # Enable debug",
|
||||
"--required # This is required",
|
||||
"--verbose # Verbose messages",
|
||||
"--version # Show version",
|
||||
},
|
||||
true,
|
||||
},
|
||||
|
||||
{
|
||||
// Long names partial
|
||||
[]string{"--ver"},
|
||||
[]string{"--verbose", "--version"},
|
||||
false,
|
||||
},
|
||||
|
||||
{
|
||||
// Commands
|
||||
[]string{""},
|
||||
[]string{"add", "add-multi", "rename", "rm"},
|
||||
false,
|
||||
},
|
||||
|
||||
{
|
||||
// Commands with descriptions
|
||||
[]string{""},
|
||||
[]string{
|
||||
"add # add an item",
|
||||
"add-multi # add multiple items",
|
||||
"rename # rename an item",
|
||||
"rm # remove an item",
|
||||
},
|
||||
true,
|
||||
},
|
||||
|
||||
{
|
||||
// Commands partial
|
||||
[]string{"r"},
|
||||
[]string{"rename", "rm"},
|
||||
false,
|
||||
},
|
||||
|
||||
{
|
||||
// Positional filename
|
||||
[]string{"add", filepath.Join(completionTestSourcedir, "completion")},
|
||||
completionTestFilename,
|
||||
false,
|
||||
},
|
||||
|
||||
{
|
||||
// Multiple positional filename (1 arg)
|
||||
[]string{"add-multi", filepath.Join(completionTestSourcedir, "completion")},
|
||||
completionTestFilename,
|
||||
false,
|
||||
},
|
||||
{
|
||||
// Multiple positional filename (2 args)
|
||||
[]string{"add-multi", filepath.Join(completionTestSourcedir, "completion.go"), filepath.Join(completionTestSourcedir, "completion")},
|
||||
completionTestFilename,
|
||||
false,
|
||||
},
|
||||
{
|
||||
// Multiple positional filename (3 args)
|
||||
[]string{"add-multi", filepath.Join(completionTestSourcedir, "completion.go"), filepath.Join(completionTestSourcedir, "completion.go"), filepath.Join(completionTestSourcedir, "completion")},
|
||||
completionTestFilename,
|
||||
false,
|
||||
},
|
||||
|
||||
{
|
||||
// Flag filename
|
||||
[]string{"rm", "-f", path.Join(completionTestSourcedir, "completion")},
|
||||
completionTestFilename,
|
||||
false,
|
||||
},
|
||||
|
||||
{
|
||||
// Flag short concat last filename
|
||||
[]string{"rm", "-of", path.Join(completionTestSourcedir, "completion")},
|
||||
completionTestFilename,
|
||||
false,
|
||||
},
|
||||
|
||||
{
|
||||
// Flag concat filename
|
||||
[]string{"rm", "-f" + path.Join(completionTestSourcedir, "completion")},
|
||||
[]string{"-f" + completionTestFilename[0], "-f" + completionTestFilename[1]},
|
||||
false,
|
||||
},
|
||||
|
||||
{
|
||||
// Flag equal concat filename
|
||||
[]string{"rm", "-f=" + path.Join(completionTestSourcedir, "completion")},
|
||||
[]string{"-f=" + completionTestFilename[0], "-f=" + completionTestFilename[1]},
|
||||
false,
|
||||
},
|
||||
|
||||
{
|
||||
// Flag concat long filename
|
||||
[]string{"rm", "--filename=" + path.Join(completionTestSourcedir, "completion")},
|
||||
[]string{"--filename=" + completionTestFilename[0], "--filename=" + completionTestFilename[1]},
|
||||
false,
|
||||
},
|
||||
|
||||
{
|
||||
// Flag long filename
|
||||
[]string{"rm", "--filename", path.Join(completionTestSourcedir, "completion")},
|
||||
completionTestFilename,
|
||||
false,
|
||||
},
|
||||
|
||||
{
|
||||
// Custom completed
|
||||
[]string{"rename", "-c", "hello un"},
|
||||
[]string{"hello universe"},
|
||||
false,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func TestCompletion(t *testing.T) {
|
||||
p := NewParser(&completionTestOptions, Default)
|
||||
c := &completion{parser: p}
|
||||
|
||||
for _, test := range completionTests {
|
||||
if test.ShowDescriptions {
|
||||
continue
|
||||
}
|
||||
|
||||
ret := c.complete(test.Args)
|
||||
items := make([]string, len(ret))
|
||||
|
||||
for i, v := range ret {
|
||||
items[i] = v.Item
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(items, test.Completed) {
|
||||
t.Errorf("Args: %#v, %#v\n Expected: %#v\n Got: %#v", test.Args, test.ShowDescriptions, test.Completed, items)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestParserCompletion(t *testing.T) {
|
||||
for _, test := range completionTests {
|
||||
if test.ShowDescriptions {
|
||||
os.Setenv("GO_FLAGS_COMPLETION", "verbose")
|
||||
} else {
|
||||
os.Setenv("GO_FLAGS_COMPLETION", "1")
|
||||
}
|
||||
|
||||
tmp := os.Stdout
|
||||
|
||||
r, w, _ := os.Pipe()
|
||||
os.Stdout = w
|
||||
|
||||
out := make(chan string)
|
||||
|
||||
go func() {
|
||||
var buf bytes.Buffer
|
||||
|
||||
io.Copy(&buf, r)
|
||||
|
||||
out <- buf.String()
|
||||
}()
|
||||
|
||||
p := NewParser(&completionTestOptions, None)
|
||||
|
||||
_, err := p.ParseArgs(test.Args)
|
||||
|
||||
w.Close()
|
||||
|
||||
os.Stdout = tmp
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error: %s", err)
|
||||
}
|
||||
|
||||
got := strings.Split(strings.Trim(<-out, "\n"), "\n")
|
||||
|
||||
if !reflect.DeepEqual(got, test.Completed) {
|
||||
t.Errorf("Expected: %#v\nGot: %#v", test.Completed, got)
|
||||
}
|
||||
}
|
||||
|
||||
os.Setenv("GO_FLAGS_COMPLETION", "")
|
||||
}
|
||||
377
Godeps/_workspace/src/github.com/jessevdk/go-flags/convert.go
generated
vendored
377
Godeps/_workspace/src/github.com/jessevdk/go-flags/convert.go
generated
vendored
@@ -1,377 +0,0 @@
|
||||
// Copyright 2012 Jesse van den Kieboom. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package flags
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Marshaler is the interface implemented by types that can marshal themselves
|
||||
// to a string representation of the flag.
|
||||
type Marshaler interface {
|
||||
// MarshalFlag marshals a flag value to its string representation.
|
||||
MarshalFlag() (string, error)
|
||||
}
|
||||
|
||||
// Unmarshaler is the interface implemented by types that can unmarshal a flag
|
||||
// argument to themselves. The provided value is directly passed from the
|
||||
// command line.
|
||||
type Unmarshaler interface {
|
||||
// UnmarshalFlag unmarshals a string value representation to the flag
|
||||
// value (which therefore needs to be a pointer receiver).
|
||||
UnmarshalFlag(value string) error
|
||||
}
|
||||
|
||||
func getBase(options multiTag, base int) (int, error) {
|
||||
sbase := options.Get("base")
|
||||
|
||||
var err error
|
||||
var ivbase int64
|
||||
|
||||
if sbase != "" {
|
||||
ivbase, err = strconv.ParseInt(sbase, 10, 32)
|
||||
base = int(ivbase)
|
||||
}
|
||||
|
||||
return base, err
|
||||
}
|
||||
|
||||
func convertMarshal(val reflect.Value) (bool, string, error) {
|
||||
// Check first for the Marshaler interface
|
||||
if val.Type().NumMethod() > 0 && val.CanInterface() {
|
||||
if marshaler, ok := val.Interface().(Marshaler); ok {
|
||||
ret, err := marshaler.MarshalFlag()
|
||||
return true, ret, err
|
||||
}
|
||||
}
|
||||
|
||||
return false, "", nil
|
||||
}
|
||||
|
||||
func convertToString(val reflect.Value, options multiTag) (string, error) {
|
||||
if ok, ret, err := convertMarshal(val); ok {
|
||||
return ret, err
|
||||
}
|
||||
|
||||
tp := val.Type()
|
||||
|
||||
// Support for time.Duration
|
||||
if tp == reflect.TypeOf((*time.Duration)(nil)).Elem() {
|
||||
stringer := val.Interface().(fmt.Stringer)
|
||||
return stringer.String(), nil
|
||||
}
|
||||
|
||||
switch tp.Kind() {
|
||||
case reflect.String:
|
||||
return val.String(), nil
|
||||
case reflect.Bool:
|
||||
if val.Bool() {
|
||||
return "true", nil
|
||||
}
|
||||
|
||||
return "false", nil
|
||||
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
|
||||
base, err := getBase(options, 10)
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return strconv.FormatInt(val.Int(), base), nil
|
||||
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
|
||||
base, err := getBase(options, 10)
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return strconv.FormatUint(val.Uint(), base), nil
|
||||
case reflect.Float32, reflect.Float64:
|
||||
return strconv.FormatFloat(val.Float(), 'g', -1, tp.Bits()), nil
|
||||
case reflect.Slice:
|
||||
if val.Len() == 0 {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
ret := "["
|
||||
|
||||
for i := 0; i < val.Len(); i++ {
|
||||
if i != 0 {
|
||||
ret += ", "
|
||||
}
|
||||
|
||||
item, err := convertToString(val.Index(i), options)
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
ret += item
|
||||
}
|
||||
|
||||
return ret + "]", nil
|
||||
case reflect.Map:
|
||||
ret := "{"
|
||||
|
||||
for i, key := range val.MapKeys() {
|
||||
if i != 0 {
|
||||
ret += ", "
|
||||
}
|
||||
|
||||
keyitem, err := convertToString(key, options)
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
item, err := convertToString(val.MapIndex(key), options)
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
ret += keyitem + ":" + item
|
||||
}
|
||||
|
||||
return ret + "}", nil
|
||||
case reflect.Ptr:
|
||||
return convertToString(reflect.Indirect(val), options)
|
||||
case reflect.Interface:
|
||||
if !val.IsNil() {
|
||||
return convertToString(val.Elem(), options)
|
||||
}
|
||||
}
|
||||
|
||||
return "", nil
|
||||
}
|
||||
|
||||
func convertUnmarshal(val string, retval reflect.Value) (bool, error) {
|
||||
if retval.Type().NumMethod() > 0 && retval.CanInterface() {
|
||||
if unmarshaler, ok := retval.Interface().(Unmarshaler); ok {
|
||||
return true, unmarshaler.UnmarshalFlag(val)
|
||||
}
|
||||
}
|
||||
|
||||
if retval.Type().Kind() != reflect.Ptr && retval.CanAddr() {
|
||||
return convertUnmarshal(val, retval.Addr())
|
||||
}
|
||||
|
||||
if retval.Type().Kind() == reflect.Interface && !retval.IsNil() {
|
||||
return convertUnmarshal(val, retval.Elem())
|
||||
}
|
||||
|
||||
return false, nil
|
||||
}
|
||||
|
||||
func convert(val string, retval reflect.Value, options multiTag) error {
|
||||
if ok, err := convertUnmarshal(val, retval); ok {
|
||||
return err
|
||||
}
|
||||
|
||||
tp := retval.Type()
|
||||
|
||||
// Support for time.Duration
|
||||
if tp == reflect.TypeOf((*time.Duration)(nil)).Elem() {
|
||||
parsed, err := time.ParseDuration(val)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
retval.SetInt(int64(parsed))
|
||||
return nil
|
||||
}
|
||||
|
||||
switch tp.Kind() {
|
||||
case reflect.String:
|
||||
retval.SetString(val)
|
||||
case reflect.Bool:
|
||||
if val == "" {
|
||||
retval.SetBool(true)
|
||||
} else {
|
||||
b, err := strconv.ParseBool(val)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
retval.SetBool(b)
|
||||
}
|
||||
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
|
||||
base, err := getBase(options, 10)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
parsed, err := strconv.ParseInt(val, base, tp.Bits())
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
retval.SetInt(parsed)
|
||||
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
|
||||
base, err := getBase(options, 10)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
parsed, err := strconv.ParseUint(val, base, tp.Bits())
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
retval.SetUint(parsed)
|
||||
case reflect.Float32, reflect.Float64:
|
||||
parsed, err := strconv.ParseFloat(val, tp.Bits())
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
retval.SetFloat(parsed)
|
||||
case reflect.Slice:
|
||||
elemtp := tp.Elem()
|
||||
|
||||
elemvalptr := reflect.New(elemtp)
|
||||
elemval := reflect.Indirect(elemvalptr)
|
||||
|
||||
if err := convert(val, elemval, options); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
retval.Set(reflect.Append(retval, elemval))
|
||||
case reflect.Map:
|
||||
parts := strings.SplitN(val, ":", 2)
|
||||
|
||||
key := parts[0]
|
||||
var value string
|
||||
|
||||
if len(parts) == 2 {
|
||||
value = parts[1]
|
||||
}
|
||||
|
||||
keytp := tp.Key()
|
||||
keyval := reflect.New(keytp)
|
||||
|
||||
if err := convert(key, keyval, options); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
valuetp := tp.Elem()
|
||||
valueval := reflect.New(valuetp)
|
||||
|
||||
if err := convert(value, valueval, options); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if retval.IsNil() {
|
||||
retval.Set(reflect.MakeMap(tp))
|
||||
}
|
||||
|
||||
retval.SetMapIndex(reflect.Indirect(keyval), reflect.Indirect(valueval))
|
||||
case reflect.Ptr:
|
||||
if retval.IsNil() {
|
||||
retval.Set(reflect.New(retval.Type().Elem()))
|
||||
}
|
||||
|
||||
return convert(val, reflect.Indirect(retval), options)
|
||||
case reflect.Interface:
|
||||
if !retval.IsNil() {
|
||||
return convert(val, retval.Elem(), options)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func isPrint(s string) bool {
|
||||
for _, c := range s {
|
||||
if !strconv.IsPrint(c) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func quoteIfNeeded(s string) string {
|
||||
if !isPrint(s) {
|
||||
return strconv.Quote(s)
|
||||
}
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
func quoteIfNeededV(s []string) []string {
|
||||
ret := make([]string, len(s))
|
||||
|
||||
for i, v := range s {
|
||||
ret[i] = quoteIfNeeded(v)
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
func quoteV(s []string) []string {
|
||||
ret := make([]string, len(s))
|
||||
|
||||
for i, v := range s {
|
||||
ret[i] = strconv.Quote(v)
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
func unquoteIfPossible(s string) (string, error) {
|
||||
if len(s) == 0 || s[0] != '"' {
|
||||
return s, nil
|
||||
}
|
||||
|
||||
return strconv.Unquote(s)
|
||||
}
|
||||
|
||||
func wrapText(s string, l int, prefix string) string {
|
||||
// Basic text wrapping of s at spaces to fit in l
|
||||
var ret string
|
||||
|
||||
s = strings.TrimSpace(s)
|
||||
|
||||
for len(s) > l {
|
||||
// Try to split on space
|
||||
suffix := ""
|
||||
|
||||
pos := strings.LastIndex(s[:l], " ")
|
||||
|
||||
if pos < 0 {
|
||||
pos = l - 1
|
||||
suffix = "-\n"
|
||||
}
|
||||
|
||||
if len(ret) != 0 {
|
||||
ret += "\n" + prefix
|
||||
}
|
||||
|
||||
ret += strings.TrimSpace(s[:pos]) + suffix
|
||||
s = strings.TrimSpace(s[pos:])
|
||||
}
|
||||
|
||||
if len(s) > 0 {
|
||||
if len(ret) != 0 {
|
||||
ret += "\n" + prefix
|
||||
}
|
||||
|
||||
return ret + s
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
175
Godeps/_workspace/src/github.com/jessevdk/go-flags/convert_test.go
generated
vendored
175
Godeps/_workspace/src/github.com/jessevdk/go-flags/convert_test.go
generated
vendored
@@ -1,175 +0,0 @@
|
||||
package flags
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func expectConvert(t *testing.T, o *Option, expected string) {
|
||||
s, err := convertToString(o.value, o.tag)
|
||||
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
assertString(t, s, expected)
|
||||
}
|
||||
|
||||
func TestConvertToString(t *testing.T) {
|
||||
d, _ := time.ParseDuration("1h2m4s")
|
||||
|
||||
var opts = struct {
|
||||
String string `long:"string"`
|
||||
|
||||
Int int `long:"int"`
|
||||
Int8 int8 `long:"int8"`
|
||||
Int16 int16 `long:"int16"`
|
||||
Int32 int32 `long:"int32"`
|
||||
Int64 int64 `long:"int64"`
|
||||
|
||||
Uint uint `long:"uint"`
|
||||
Uint8 uint8 `long:"uint8"`
|
||||
Uint16 uint16 `long:"uint16"`
|
||||
Uint32 uint32 `long:"uint32"`
|
||||
Uint64 uint64 `long:"uint64"`
|
||||
|
||||
Float32 float32 `long:"float32"`
|
||||
Float64 float64 `long:"float64"`
|
||||
|
||||
Duration time.Duration `long:"duration"`
|
||||
|
||||
Bool bool `long:"bool"`
|
||||
|
||||
IntSlice []int `long:"int-slice"`
|
||||
IntFloatMap map[int]float64 `long:"int-float-map"`
|
||||
|
||||
PtrBool *bool `long:"ptr-bool"`
|
||||
Interface interface{} `long:"interface"`
|
||||
|
||||
Int32Base int32 `long:"int32-base" base:"16"`
|
||||
Uint32Base uint32 `long:"uint32-base" base:"16"`
|
||||
}{
|
||||
"string",
|
||||
|
||||
-2,
|
||||
-1,
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
|
||||
1.2,
|
||||
-3.4,
|
||||
|
||||
d,
|
||||
true,
|
||||
|
||||
[]int{-3, 4, -2},
|
||||
map[int]float64{-2: 4.5},
|
||||
|
||||
new(bool),
|
||||
float32(5.2),
|
||||
|
||||
-5823,
|
||||
4232,
|
||||
}
|
||||
|
||||
p := NewNamedParser("test", Default)
|
||||
grp, _ := p.AddGroup("test group", "", &opts)
|
||||
|
||||
expects := []string{
|
||||
"string",
|
||||
"-2",
|
||||
"-1",
|
||||
"0",
|
||||
"1",
|
||||
"2",
|
||||
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"5",
|
||||
|
||||
"1.2",
|
||||
"-3.4",
|
||||
|
||||
"1h2m4s",
|
||||
"true",
|
||||
|
||||
"[-3, 4, -2]",
|
||||
"{-2:4.5}",
|
||||
|
||||
"false",
|
||||
"5.2",
|
||||
|
||||
"-16bf",
|
||||
"1088",
|
||||
}
|
||||
|
||||
for i, v := range grp.Options() {
|
||||
expectConvert(t, v, expects[i])
|
||||
}
|
||||
}
|
||||
|
||||
func TestConvertToStringInvalidIntBase(t *testing.T) {
|
||||
var opts = struct {
|
||||
Int int `long:"int" base:"no"`
|
||||
}{
|
||||
2,
|
||||
}
|
||||
|
||||
p := NewNamedParser("test", Default)
|
||||
grp, _ := p.AddGroup("test group", "", &opts)
|
||||
o := grp.Options()[0]
|
||||
|
||||
_, err := convertToString(o.value, o.tag)
|
||||
|
||||
if err != nil {
|
||||
err = newErrorf(ErrMarshal, "%v", err)
|
||||
}
|
||||
|
||||
assertError(t, err, ErrMarshal, "strconv.ParseInt: parsing \"no\": invalid syntax")
|
||||
}
|
||||
|
||||
func TestConvertToStringInvalidUintBase(t *testing.T) {
|
||||
var opts = struct {
|
||||
Uint uint `long:"uint" base:"no"`
|
||||
}{
|
||||
2,
|
||||
}
|
||||
|
||||
p := NewNamedParser("test", Default)
|
||||
grp, _ := p.AddGroup("test group", "", &opts)
|
||||
o := grp.Options()[0]
|
||||
|
||||
_, err := convertToString(o.value, o.tag)
|
||||
|
||||
if err != nil {
|
||||
err = newErrorf(ErrMarshal, "%v", err)
|
||||
}
|
||||
|
||||
assertError(t, err, ErrMarshal, "strconv.ParseInt: parsing \"no\": invalid syntax")
|
||||
}
|
||||
|
||||
func TestWrapText(t *testing.T) {
|
||||
s := "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
|
||||
|
||||
got := wrapText(s, 60, " ")
|
||||
expected := `Lorem ipsum dolor sit amet, consectetur adipisicing elit,
|
||||
sed do eiusmod tempor incididunt ut labore et dolore magna
|
||||
aliqua. Ut enim ad minim veniam, quis nostrud exercitation
|
||||
ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
||||
Duis aute irure dolor in reprehenderit in voluptate velit
|
||||
esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
|
||||
occaecat cupidatat non proident, sunt in culpa qui officia
|
||||
deserunt mollit anim id est laborum.`
|
||||
|
||||
assertDiff(t, got, expected, "wrapped text")
|
||||
}
|
||||
123
Godeps/_workspace/src/github.com/jessevdk/go-flags/error.go
generated
vendored
123
Godeps/_workspace/src/github.com/jessevdk/go-flags/error.go
generated
vendored
@@ -1,123 +0,0 @@
|
||||
package flags
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// ErrorType represents the type of error.
|
||||
type ErrorType uint
|
||||
|
||||
const (
|
||||
// ErrUnknown indicates a generic error.
|
||||
ErrUnknown ErrorType = iota
|
||||
|
||||
// ErrExpectedArgument indicates that an argument was expected.
|
||||
ErrExpectedArgument
|
||||
|
||||
// ErrUnknownFlag indicates an unknown flag.
|
||||
ErrUnknownFlag
|
||||
|
||||
// ErrUnknownGroup indicates an unknown group.
|
||||
ErrUnknownGroup
|
||||
|
||||
// ErrMarshal indicates a marshalling error while converting values.
|
||||
ErrMarshal
|
||||
|
||||
// ErrHelp indicates that the built-in help was shown (the error
|
||||
// contains the help message).
|
||||
ErrHelp
|
||||
|
||||
// ErrNoArgumentForBool indicates that an argument was given for a
|
||||
// boolean flag (which don't not take any arguments).
|
||||
ErrNoArgumentForBool
|
||||
|
||||
// ErrRequired indicates that a required flag was not provided.
|
||||
ErrRequired
|
||||
|
||||
// ErrShortNameTooLong indicates that a short flag name was specified,
|
||||
// longer than one character.
|
||||
ErrShortNameTooLong
|
||||
|
||||
// ErrDuplicatedFlag indicates that a short or long flag has been
|
||||
// defined more than once
|
||||
ErrDuplicatedFlag
|
||||
|
||||
// ErrTag indicates an error while parsing flag tags.
|
||||
ErrTag
|
||||
|
||||
// ErrCommandRequired indicates that a command was required but not
|
||||
// specified
|
||||
ErrCommandRequired
|
||||
|
||||
// ErrUnknownCommand indicates that an unknown command was specified.
|
||||
ErrUnknownCommand
|
||||
)
|
||||
|
||||
func (e ErrorType) String() string {
|
||||
switch e {
|
||||
case ErrUnknown:
|
||||
return "unknown"
|
||||
case ErrExpectedArgument:
|
||||
return "expected argument"
|
||||
case ErrUnknownFlag:
|
||||
return "unknown flag"
|
||||
case ErrUnknownGroup:
|
||||
return "unknown group"
|
||||
case ErrMarshal:
|
||||
return "marshal"
|
||||
case ErrHelp:
|
||||
return "help"
|
||||
case ErrNoArgumentForBool:
|
||||
return "no argument for bool"
|
||||
case ErrRequired:
|
||||
return "required"
|
||||
case ErrShortNameTooLong:
|
||||
return "short name too long"
|
||||
case ErrDuplicatedFlag:
|
||||
return "duplicated flag"
|
||||
case ErrTag:
|
||||
return "tag"
|
||||
case ErrCommandRequired:
|
||||
return "command required"
|
||||
case ErrUnknownCommand:
|
||||
return "unknown command"
|
||||
}
|
||||
|
||||
return "unrecognized error type"
|
||||
}
|
||||
|
||||
// Error represents a parser error. The error returned from Parse is of this
|
||||
// type. The error contains both a Type and Message.
|
||||
type Error struct {
|
||||
// The type of error
|
||||
Type ErrorType
|
||||
|
||||
// The error message
|
||||
Message string
|
||||
}
|
||||
|
||||
// Error returns the error's message
|
||||
func (e *Error) Error() string {
|
||||
return e.Message
|
||||
}
|
||||
|
||||
func newError(tp ErrorType, message string) *Error {
|
||||
return &Error{
|
||||
Type: tp,
|
||||
Message: message,
|
||||
}
|
||||
}
|
||||
|
||||
func newErrorf(tp ErrorType, format string, args ...interface{}) *Error {
|
||||
return newError(tp, fmt.Sprintf(format, args...))
|
||||
}
|
||||
|
||||
func wrapError(err error) *Error {
|
||||
ret, ok := err.(*Error)
|
||||
|
||||
if !ok {
|
||||
return newError(ErrUnknown, err.Error())
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
110
Godeps/_workspace/src/github.com/jessevdk/go-flags/example_test.go
generated
vendored
110
Godeps/_workspace/src/github.com/jessevdk/go-flags/example_test.go
generated
vendored
@@ -1,110 +0,0 @@
|
||||
// Example of use of the flags package.
|
||||
package flags
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
func Example() {
|
||||
var opts struct {
|
||||
// Slice of bool will append 'true' each time the option
|
||||
// is encountered (can be set multiple times, like -vvv)
|
||||
Verbose []bool `short:"v" long:"verbose" description:"Show verbose debug information"`
|
||||
|
||||
// Example of automatic marshalling to desired type (uint)
|
||||
Offset uint `long:"offset" description:"Offset"`
|
||||
|
||||
// Example of a callback, called each time the option is found.
|
||||
Call func(string) `short:"c" description:"Call phone number"`
|
||||
|
||||
// Example of a required flag
|
||||
Name string `short:"n" long:"name" description:"A name" required:"true"`
|
||||
|
||||
// Example of a value name
|
||||
File string `short:"f" long:"file" description:"A file" value-name:"FILE"`
|
||||
|
||||
// Example of a pointer
|
||||
Ptr *int `short:"p" description:"A pointer to an integer"`
|
||||
|
||||
// Example of a slice of strings
|
||||
StringSlice []string `short:"s" description:"A slice of strings"`
|
||||
|
||||
// Example of a slice of pointers
|
||||
PtrSlice []*string `long:"ptrslice" description:"A slice of pointers to string"`
|
||||
|
||||
// Example of a map
|
||||
IntMap map[string]int `long:"intmap" description:"A map from string to int"`
|
||||
|
||||
// Example of a filename (useful for completion)
|
||||
Filename Filename `long:"filename" description:"A filename"`
|
||||
|
||||
// Example of positional arguments
|
||||
Args struct {
|
||||
Id string
|
||||
Num int
|
||||
Rest []string
|
||||
} `positional-args:"yes" required:"yes"`
|
||||
}
|
||||
|
||||
// Callback which will invoke callto:<argument> to call a number.
|
||||
// Note that this works just on OS X (and probably only with
|
||||
// Skype) but it shows the idea.
|
||||
opts.Call = func(num string) {
|
||||
cmd := exec.Command("open", "callto:"+num)
|
||||
cmd.Start()
|
||||
cmd.Process.Release()
|
||||
}
|
||||
|
||||
// Make some fake arguments to parse.
|
||||
args := []string{
|
||||
"-vv",
|
||||
"--offset=5",
|
||||
"-n", "Me",
|
||||
"-p", "3",
|
||||
"-s", "hello",
|
||||
"-s", "world",
|
||||
"--ptrslice", "hello",
|
||||
"--ptrslice", "world",
|
||||
"--intmap", "a:1",
|
||||
"--intmap", "b:5",
|
||||
"--filename", "hello.go",
|
||||
"id",
|
||||
"10",
|
||||
"remaining1",
|
||||
"remaining2",
|
||||
}
|
||||
|
||||
// Parse flags from `args'. Note that here we use flags.ParseArgs for
|
||||
// the sake of making a working example. Normally, you would simply use
|
||||
// flags.Parse(&opts) which uses os.Args
|
||||
_, err := ParseArgs(&opts, args)
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Printf("Verbosity: %v\n", opts.Verbose)
|
||||
fmt.Printf("Offset: %d\n", opts.Offset)
|
||||
fmt.Printf("Name: %s\n", opts.Name)
|
||||
fmt.Printf("Ptr: %d\n", *opts.Ptr)
|
||||
fmt.Printf("StringSlice: %v\n", opts.StringSlice)
|
||||
fmt.Printf("PtrSlice: [%v %v]\n", *opts.PtrSlice[0], *opts.PtrSlice[1])
|
||||
fmt.Printf("IntMap: [a:%v b:%v]\n", opts.IntMap["a"], opts.IntMap["b"])
|
||||
fmt.Printf("Filename: %v\n", opts.Filename)
|
||||
fmt.Printf("Args.Id: %s\n", opts.Args.Id)
|
||||
fmt.Printf("Args.Num: %d\n", opts.Args.Num)
|
||||
fmt.Printf("Args.Rest: %v\n", opts.Args.Rest)
|
||||
|
||||
// Output: Verbosity: [true true]
|
||||
// Offset: 5
|
||||
// Name: Me
|
||||
// Ptr: 3
|
||||
// StringSlice: [hello world]
|
||||
// PtrSlice: [hello world]
|
||||
// IntMap: [a:1 b:5]
|
||||
// Filename: hello.go
|
||||
// Args.Id: id
|
||||
// Args.Num: 10
|
||||
// Args.Rest: [remaining1 remaining2]
|
||||
}
|
||||
23
Godeps/_workspace/src/github.com/jessevdk/go-flags/examples/add.go
generated
vendored
23
Godeps/_workspace/src/github.com/jessevdk/go-flags/examples/add.go
generated
vendored
@@ -1,23 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type AddCommand struct {
|
||||
All bool `short:"a" long:"all" description:"Add all files"`
|
||||
}
|
||||
|
||||
var addCommand AddCommand
|
||||
|
||||
func (x *AddCommand) Execute(args []string) error {
|
||||
fmt.Printf("Adding (all=%v): %#v\n", x.All, args)
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
parser.AddCommand("add",
|
||||
"Add a file",
|
||||
"The add command adds a file to the repository. Use -a to add all files.",
|
||||
&addCommand)
|
||||
}
|
||||
9
Godeps/_workspace/src/github.com/jessevdk/go-flags/examples/bash-completion
generated
vendored
9
Godeps/_workspace/src/github.com/jessevdk/go-flags/examples/bash-completion
generated
vendored
@@ -1,9 +0,0 @@
|
||||
_examples() {
|
||||
args=("${COMP_WORDS[@]:1:$COMP_CWORD}")
|
||||
|
||||
local IFS=$'\n'
|
||||
COMPREPLY=($(GO_FLAGS_COMPLETION=1 ${COMP_WORDS[0]} "${args[@]}"))
|
||||
return 1
|
||||
}
|
||||
|
||||
complete -F _examples examples
|
||||
75
Godeps/_workspace/src/github.com/jessevdk/go-flags/examples/main.go
generated
vendored
75
Godeps/_workspace/src/github.com/jessevdk/go-flags/examples/main.go
generated
vendored
@@ -1,75 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/jessevdk/go-flags"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type EditorOptions struct {
|
||||
Input flags.Filename `short:"i" long:"input" description:"Input file" default:"-"`
|
||||
Output flags.Filename `short:"o" long:"output" description:"Output file" default:"-"`
|
||||
}
|
||||
|
||||
type Point struct {
|
||||
X, Y int
|
||||
}
|
||||
|
||||
func (p *Point) UnmarshalFlag(value string) error {
|
||||
parts := strings.Split(value, ",")
|
||||
|
||||
if len(parts) != 2 {
|
||||
return errors.New("expected two numbers separated by a ,")
|
||||
}
|
||||
|
||||
x, err := strconv.ParseInt(parts[0], 10, 32)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
y, err := strconv.ParseInt(parts[1], 10, 32)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
p.X = int(x)
|
||||
p.Y = int(y)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p Point) MarshalFlag() (string, error) {
|
||||
return fmt.Sprintf("%d,%d", p.X, p.Y), nil
|
||||
}
|
||||
|
||||
type Options struct {
|
||||
// Example of verbosity with level
|
||||
Verbose []bool `short:"v" long:"verbose" description:"Verbose output"`
|
||||
|
||||
// Example of optional value
|
||||
User string `short:"u" long:"user" description:"User name" optional:"yes" optional-value:"pancake"`
|
||||
|
||||
// Example of map with multiple default values
|
||||
Users map[string]string `long:"users" description:"User e-mail map" default:"system:system@example.org" default:"admin:admin@example.org"`
|
||||
|
||||
// Example of option group
|
||||
Editor EditorOptions `group:"Editor Options"`
|
||||
|
||||
// Example of custom type Marshal/Unmarshal
|
||||
Point Point `long:"point" description:"A x,y point" default:"1,2"`
|
||||
}
|
||||
|
||||
var options Options
|
||||
|
||||
var parser = flags.NewParser(&options, flags.Default)
|
||||
|
||||
func main() {
|
||||
if _, err := parser.Parse(); err != nil {
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
23
Godeps/_workspace/src/github.com/jessevdk/go-flags/examples/rm.go
generated
vendored
23
Godeps/_workspace/src/github.com/jessevdk/go-flags/examples/rm.go
generated
vendored
@@ -1,23 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type RmCommand struct {
|
||||
Force bool `short:"f" long:"force" description:"Force removal of files"`
|
||||
}
|
||||
|
||||
var rmCommand RmCommand
|
||||
|
||||
func (x *RmCommand) Execute(args []string) error {
|
||||
fmt.Printf("Removing (force=%v): %#v\n", x.Force, args)
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
parser.AddCommand("rm",
|
||||
"Remove a file",
|
||||
"The rm command removes a file to the repository. Use -f to force removal of files.",
|
||||
&rmCommand)
|
||||
}
|
||||
246
Godeps/_workspace/src/github.com/jessevdk/go-flags/flags.go
generated
vendored
246
Godeps/_workspace/src/github.com/jessevdk/go-flags/flags.go
generated
vendored
@@ -1,246 +0,0 @@
|
||||
// Copyright 2012 Jesse van den Kieboom. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
/*
|
||||
Package flags provides an extensive command line option parser.
|
||||
The flags package is similar in functionality to the go built-in flag package
|
||||
but provides more options and uses reflection to provide a convenient and
|
||||
succinct way of specifying command line options.
|
||||
|
||||
|
||||
Supported features
|
||||
|
||||
The following features are supported in go-flags:
|
||||
|
||||
Options with short names (-v)
|
||||
Options with long names (--verbose)
|
||||
Options with and without arguments (bool v.s. other type)
|
||||
Options with optional arguments and default values
|
||||
Option default values from ENVIRONMENT_VARIABLES, including slice and map values
|
||||
Multiple option groups each containing a set of options
|
||||
Generate and print well-formatted help message
|
||||
Passing remaining command line arguments after -- (optional)
|
||||
Ignoring unknown command line options (optional)
|
||||
Supports -I/usr/include -I=/usr/include -I /usr/include option argument specification
|
||||
Supports multiple short options -aux
|
||||
Supports all primitive go types (string, int{8..64}, uint{8..64}, float)
|
||||
Supports same option multiple times (can store in slice or last option counts)
|
||||
Supports maps
|
||||
Supports function callbacks
|
||||
Supports namespaces for (nested) option groups
|
||||
|
||||
Additional features specific to Windows:
|
||||
Options with short names (/v)
|
||||
Options with long names (/verbose)
|
||||
Windows-style options with arguments use a colon as the delimiter
|
||||
Modify generated help message with Windows-style / options
|
||||
|
||||
|
||||
Basic usage
|
||||
|
||||
The flags package uses structs, reflection and struct field tags
|
||||
to allow users to specify command line options. This results in very simple
|
||||
and concise specification of your application options. For example:
|
||||
|
||||
type Options struct {
|
||||
Verbose []bool `short:"v" long:"verbose" description:"Show verbose debug information"`
|
||||
}
|
||||
|
||||
This specifies one option with a short name -v and a long name --verbose.
|
||||
When either -v or --verbose is found on the command line, a 'true' value
|
||||
will be appended to the Verbose field. e.g. when specifying -vvv, the
|
||||
resulting value of Verbose will be {[true, true, true]}.
|
||||
|
||||
Slice options work exactly the same as primitive type options, except that
|
||||
whenever the option is encountered, a value is appended to the slice.
|
||||
|
||||
Map options from string to primitive type are also supported. On the command
|
||||
line, you specify the value for such an option as key:value. For example
|
||||
|
||||
type Options struct {
|
||||
AuthorInfo string[string] `short:"a"`
|
||||
}
|
||||
|
||||
Then, the AuthorInfo map can be filled with something like
|
||||
-a name:Jesse -a "surname:van den Kieboom".
|
||||
|
||||
Finally, for full control over the conversion between command line argument
|
||||
values and options, user defined types can choose to implement the Marshaler
|
||||
and Unmarshaler interfaces.
|
||||
|
||||
|
||||
Available field tags
|
||||
|
||||
The following is a list of tags for struct fields supported by go-flags:
|
||||
|
||||
short: the short name of the option (single character)
|
||||
long: the long name of the option
|
||||
required: whether an option is required to appear on the command
|
||||
line. If a required option is not present, the parser will
|
||||
return ErrRequired (optional)
|
||||
description: the description of the option (optional)
|
||||
long-description: the long description of the option. Currently only
|
||||
displayed in generated man pages (optional)
|
||||
no-flag: if non-empty this field is ignored as an option (optional)
|
||||
|
||||
optional: whether an argument of the option is optional (optional)
|
||||
optional-value: the value of an optional option when the option occurs
|
||||
without an argument. This tag can be specified multiple
|
||||
times in the case of maps or slices (optional)
|
||||
default: the default value of an option. This tag can be specified
|
||||
multiple times in the case of slices or maps (optional)
|
||||
default-mask: when specified, this value will be displayed in the help
|
||||
instead of the actual default value. This is useful
|
||||
mostly for hiding otherwise sensitive information from
|
||||
showing up in the help. If default-mask takes the special
|
||||
value "-", then no default value will be shown at all
|
||||
(optional)
|
||||
env: the default value of the option is overridden from the
|
||||
specified environment variable, if one has been defined.
|
||||
(optional)
|
||||
env-delim: the 'env' default value from environment is split into
|
||||
multiple values with the given delimiter string, use with
|
||||
slices and maps (optional)
|
||||
value-name: the name of the argument value (to be shown in the help)
|
||||
(optional)
|
||||
|
||||
base: a base (radix) used to convert strings to integer values, the
|
||||
default base is 10 (i.e. decimal) (optional)
|
||||
|
||||
ini-name: the explicit ini option name (optional)
|
||||
no-ini: if non-empty this field is ignored as an ini option
|
||||
(optional)
|
||||
|
||||
group: when specified on a struct field, makes the struct
|
||||
field a separate group with the given name (optional)
|
||||
namespace: when specified on a group struct field, the namespace
|
||||
gets prepended to every option's long name and
|
||||
subgroup's namespace of this group, separated by
|
||||
the parser's namespace delimiter (optional)
|
||||
command: when specified on a struct field, makes the struct
|
||||
field a (sub)command with the given name (optional)
|
||||
subcommands-optional: when specified on a command struct field, makes
|
||||
any subcommands of that command optional (optional)
|
||||
alias: when specified on a command struct field, adds the
|
||||
specified name as an alias for the command. Can be
|
||||
be specified multiple times to add more than one
|
||||
alias (optional)
|
||||
positional-args: when specified on a field with a struct type,
|
||||
uses the fields of that struct to parse remaining
|
||||
positional command line arguments into (in order
|
||||
of the fields). If a field has a slice type,
|
||||
then all remaining arguments will be added to it.
|
||||
Positional arguments are optional by default,
|
||||
unless the "required" tag is specified together
|
||||
with the "positional-args" tag (optional)
|
||||
positional-arg-name: used on a field in a positional argument struct; name
|
||||
of the positional argument placeholder to be shown in
|
||||
the help (optional)
|
||||
|
||||
|
||||
Either the `short:` tag or the `long:` must be specified to make the field eligible as an
|
||||
option.
|
||||
|
||||
|
||||
Option groups
|
||||
|
||||
Option groups are a simple way to semantically separate your options. All
|
||||
options in a particular group are shown together in the help under the name
|
||||
of the group. Namespaces can be used to specify option long names more
|
||||
precisely and emphasize the options affiliation to their group.
|
||||
|
||||
There are currently three ways to specify option groups.
|
||||
|
||||
1. Use NewNamedParser specifying the various option groups.
|
||||
2. Use AddGroup to add a group to an existing parser.
|
||||
3. Add a struct field to the top-level options annotated with the
|
||||
group:"group-name" tag.
|
||||
|
||||
|
||||
|
||||
Commands
|
||||
|
||||
The flags package also has basic support for commands. Commands are often
|
||||
used in monolithic applications that support various commands or actions.
|
||||
Take git for example, all of the add, commit, checkout, etc. are called
|
||||
commands. Using commands you can easily separate multiple functions of your
|
||||
application.
|
||||
|
||||
There are currently two ways to specify a command.
|
||||
|
||||
1. Use AddCommand on an existing parser.
|
||||
2. Add a struct field to your options struct annotated with the
|
||||
command:"command-name" tag.
|
||||
|
||||
The most common, idiomatic way to implement commands is to define a global
|
||||
parser instance and implement each command in a separate file. These
|
||||
command files should define a go init function which calls AddCommand on
|
||||
the global parser.
|
||||
|
||||
When parsing ends and there is an active command and that command implements
|
||||
the Commander interface, then its Execute method will be run with the
|
||||
remaining command line arguments.
|
||||
|
||||
Command structs can have options which become valid to parse after the
|
||||
command has been specified on the command line, in addition to the options
|
||||
of all the parent commands. I.e. considering a -v flag on the parser and an
|
||||
add command, the following are equivalent:
|
||||
|
||||
./app -v add
|
||||
./app add -v
|
||||
|
||||
However, if the -v flag is defined on the add command, then the first of
|
||||
the two examples above would fail since the -v flag is not defined before
|
||||
the add command.
|
||||
|
||||
|
||||
Completion
|
||||
|
||||
go-flags has builtin support to provide bash completion of flags, commands
|
||||
and argument values. To use completion, the binary which uses go-flags
|
||||
can be invoked in a special environment to list completion of the current
|
||||
command line argument. It should be noted that this `executes` your application,
|
||||
and it is up to the user to make sure there are no negative side effects (for
|
||||
example from init functions).
|
||||
|
||||
Setting the environment variable `GO_FLAGS_COMPLETION=1` enables completion
|
||||
by replacing the argument parsing routine with the completion routine which
|
||||
outputs completions for the passed arguments. The basic invocation to
|
||||
complete a set of arguments is therefore:
|
||||
|
||||
GO_FLAGS_COMPLETION=1 ./completion-example arg1 arg2 arg3
|
||||
|
||||
where `completion-example` is the binary, `arg1` and `arg2` are
|
||||
the current arguments, and `arg3` (the last argument) is the argument
|
||||
to be completed. If the GO_FLAGS_COMPLETION is set to "verbose", then
|
||||
descriptions of possible completion items will also be shown, if there
|
||||
are more than 1 completion items.
|
||||
|
||||
To use this with bash completion, a simple file can be written which
|
||||
calls the binary which supports go-flags completion:
|
||||
|
||||
_completion_example() {
|
||||
# All arguments except the first one
|
||||
args=("${COMP_WORDS[@]:1:$COMP_CWORD}")
|
||||
|
||||
# Only split on newlines
|
||||
local IFS=$'\n'
|
||||
|
||||
# Call completion (note that the first element of COMP_WORDS is
|
||||
# the executable itself)
|
||||
COMPREPLY=($(GO_FLAGS_COMPLETION=1 ${COMP_WORDS[0]} "${args[@]}"))
|
||||
return 0
|
||||
}
|
||||
|
||||
complete -F _completion_example completion-example
|
||||
|
||||
Completion requires the parser option PassDoubleDash and is therefore enforced if the environment variable GO_FLAGS_COMPLETION is set.
|
||||
|
||||
Customized completion for argument values is supported by implementing
|
||||
the flags.Completer interface for the argument value type. An example
|
||||
of a type which does so is the flags.Filename type, an alias of string
|
||||
allowing simple filename completion. A slice or array argument value
|
||||
whose element type implements flags.Completer will also be completed.
|
||||
*/
|
||||
package flags
|
||||
91
Godeps/_workspace/src/github.com/jessevdk/go-flags/group.go
generated
vendored
91
Godeps/_workspace/src/github.com/jessevdk/go-flags/group.go
generated
vendored
@@ -1,91 +0,0 @@
|
||||
// Copyright 2012 Jesse van den Kieboom. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package flags
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// ErrNotPointerToStruct indicates that a provided data container is not
|
||||
// a pointer to a struct. Only pointers to structs are valid data containers
|
||||
// for options.
|
||||
var ErrNotPointerToStruct = errors.New("provided data is not a pointer to struct")
|
||||
|
||||
// Group represents an option group. Option groups can be used to logically
|
||||
// group options together under a description. Groups are only used to provide
|
||||
// more structure to options both for the user (as displayed in the help message)
|
||||
// and for you, since groups can be nested.
|
||||
type Group struct {
|
||||
// A short description of the group. The
|
||||
// short description is primarily used in the built-in generated help
|
||||
// message
|
||||
ShortDescription string
|
||||
|
||||
// A long description of the group. The long
|
||||
// description is primarily used to present information on commands
|
||||
// (Command embeds Group) in the built-in generated help and man pages.
|
||||
LongDescription string
|
||||
|
||||
// The namespace of the group
|
||||
Namespace string
|
||||
|
||||
// The parent of the group or nil if it has no parent
|
||||
parent interface{}
|
||||
|
||||
// All the options in the group
|
||||
options []*Option
|
||||
|
||||
// All the subgroups
|
||||
groups []*Group
|
||||
|
||||
// Whether the group represents the built-in help group
|
||||
isBuiltinHelp bool
|
||||
|
||||
data interface{}
|
||||
}
|
||||
|
||||
// AddGroup adds a new group to the command with the given name and data. The
|
||||
// data needs to be a pointer to a struct from which the fields indicate which
|
||||
// options are in the group.
|
||||
func (g *Group) AddGroup(shortDescription string, longDescription string, data interface{}) (*Group, error) {
|
||||
group := newGroup(shortDescription, longDescription, data)
|
||||
|
||||
group.parent = g
|
||||
|
||||
if err := group.scan(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
g.groups = append(g.groups, group)
|
||||
return group, nil
|
||||
}
|
||||
|
||||
// Groups returns the list of groups embedded in this group.
|
||||
func (g *Group) Groups() []*Group {
|
||||
return g.groups
|
||||
}
|
||||
|
||||
// Options returns the list of options in this group.
|
||||
func (g *Group) Options() []*Option {
|
||||
return g.options
|
||||
}
|
||||
|
||||
// Find locates the subgroup with the given short description and returns it.
|
||||
// If no such group can be found Find will return nil. Note that the description
|
||||
// is matched case insensitively.
|
||||
func (g *Group) Find(shortDescription string) *Group {
|
||||
lshortDescription := strings.ToLower(shortDescription)
|
||||
|
||||
var ret *Group
|
||||
|
||||
g.eachGroup(func(gg *Group) {
|
||||
if gg != g && strings.ToLower(gg.ShortDescription) == lshortDescription {
|
||||
ret = gg
|
||||
}
|
||||
})
|
||||
|
||||
return ret
|
||||
}
|
||||
254
Godeps/_workspace/src/github.com/jessevdk/go-flags/group_private.go
generated
vendored
254
Godeps/_workspace/src/github.com/jessevdk/go-flags/group_private.go
generated
vendored
@@ -1,254 +0,0 @@
|
||||
package flags
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"unicode/utf8"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
type scanHandler func(reflect.Value, *reflect.StructField) (bool, error)
|
||||
|
||||
func newGroup(shortDescription string, longDescription string, data interface{}) *Group {
|
||||
return &Group{
|
||||
ShortDescription: shortDescription,
|
||||
LongDescription: longDescription,
|
||||
|
||||
data: data,
|
||||
}
|
||||
}
|
||||
|
||||
func (g *Group) optionByName(name string, namematch func(*Option, string) bool) *Option {
|
||||
prio := 0
|
||||
var retopt *Option
|
||||
|
||||
for _, opt := range g.options {
|
||||
if namematch != nil && namematch(opt, name) && prio < 4 {
|
||||
retopt = opt
|
||||
prio = 4
|
||||
}
|
||||
|
||||
if name == opt.field.Name && prio < 3 {
|
||||
retopt = opt
|
||||
prio = 3
|
||||
}
|
||||
|
||||
if name == opt.LongNameWithNamespace() && prio < 2 {
|
||||
retopt = opt
|
||||
prio = 2
|
||||
}
|
||||
|
||||
if opt.ShortName != 0 && name == string(opt.ShortName) && prio < 1 {
|
||||
retopt = opt
|
||||
prio = 1
|
||||
}
|
||||
}
|
||||
|
||||
return retopt
|
||||
}
|
||||
|
||||
func (g *Group) eachGroup(f func(*Group)) {
|
||||
f(g)
|
||||
|
||||
for _, gg := range g.groups {
|
||||
gg.eachGroup(f)
|
||||
}
|
||||
}
|
||||
|
||||
func (g *Group) scanStruct(realval reflect.Value, sfield *reflect.StructField, handler scanHandler) error {
|
||||
stype := realval.Type()
|
||||
|
||||
if sfield != nil {
|
||||
if ok, err := handler(realval, sfield); err != nil {
|
||||
return err
|
||||
} else if ok {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
for i := 0; i < stype.NumField(); i++ {
|
||||
field := stype.Field(i)
|
||||
|
||||
// PkgName is set only for non-exported fields, which we ignore
|
||||
if field.PkgPath != "" {
|
||||
continue
|
||||
}
|
||||
|
||||
mtag := newMultiTag(string(field.Tag))
|
||||
|
||||
if err := mtag.Parse(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Skip fields with the no-flag tag
|
||||
if mtag.Get("no-flag") != "" {
|
||||
continue
|
||||
}
|
||||
|
||||
// Dive deep into structs or pointers to structs
|
||||
kind := field.Type.Kind()
|
||||
fld := realval.Field(i)
|
||||
|
||||
if kind == reflect.Struct {
|
||||
if err := g.scanStruct(fld, &field, handler); err != nil {
|
||||
return err
|
||||
}
|
||||
} else if kind == reflect.Ptr && field.Type.Elem().Kind() == reflect.Struct {
|
||||
if fld.IsNil() {
|
||||
fld.Set(reflect.New(fld.Type().Elem()))
|
||||
}
|
||||
|
||||
if err := g.scanStruct(reflect.Indirect(fld), &field, handler); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
longname := mtag.Get("long")
|
||||
shortname := mtag.Get("short")
|
||||
|
||||
// Need at least either a short or long name
|
||||
if longname == "" && shortname == "" && mtag.Get("ini-name") == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
short := rune(0)
|
||||
rc := utf8.RuneCountInString(shortname)
|
||||
|
||||
if rc > 1 {
|
||||
return newErrorf(ErrShortNameTooLong,
|
||||
"short names can only be 1 character long, not `%s'",
|
||||
shortname)
|
||||
|
||||
} else if rc == 1 {
|
||||
short, _ = utf8.DecodeRuneInString(shortname)
|
||||
}
|
||||
|
||||
description := mtag.Get("description")
|
||||
def := mtag.GetMany("default")
|
||||
|
||||
optionalValue := mtag.GetMany("optional-value")
|
||||
valueName := mtag.Get("value-name")
|
||||
defaultMask := mtag.Get("default-mask")
|
||||
|
||||
optional := (mtag.Get("optional") != "")
|
||||
required := (mtag.Get("required") != "")
|
||||
|
||||
option := &Option{
|
||||
Description: description,
|
||||
ShortName: short,
|
||||
LongName: longname,
|
||||
Default: def,
|
||||
EnvDefaultKey: mtag.Get("env"),
|
||||
EnvDefaultDelim: mtag.Get("env-delim"),
|
||||
OptionalArgument: optional,
|
||||
OptionalValue: optionalValue,
|
||||
Required: required,
|
||||
ValueName: valueName,
|
||||
DefaultMask: defaultMask,
|
||||
|
||||
group: g,
|
||||
|
||||
field: field,
|
||||
value: realval.Field(i),
|
||||
tag: mtag,
|
||||
}
|
||||
|
||||
g.options = append(g.options, option)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (g *Group) checkForDuplicateFlags() *Error {
|
||||
shortNames := make(map[rune]*Option)
|
||||
longNames := make(map[string]*Option)
|
||||
|
||||
var duplicateError *Error
|
||||
|
||||
g.eachGroup(func(g *Group) {
|
||||
for _, option := range g.options {
|
||||
if option.LongName != "" {
|
||||
longName := option.LongNameWithNamespace()
|
||||
|
||||
if otherOption, ok := longNames[longName]; ok {
|
||||
duplicateError = newErrorf(ErrDuplicatedFlag, "option `%s' uses the same long name as option `%s'", option, otherOption)
|
||||
return
|
||||
}
|
||||
longNames[longName] = option
|
||||
}
|
||||
if option.ShortName != 0 {
|
||||
if otherOption, ok := shortNames[option.ShortName]; ok {
|
||||
duplicateError = newErrorf(ErrDuplicatedFlag, "option `%s' uses the same short name as option `%s'", option, otherOption)
|
||||
return
|
||||
}
|
||||
shortNames[option.ShortName] = option
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
return duplicateError
|
||||
}
|
||||
|
||||
func (g *Group) scanSubGroupHandler(realval reflect.Value, sfield *reflect.StructField) (bool, error) {
|
||||
mtag := newMultiTag(string(sfield.Tag))
|
||||
|
||||
if err := mtag.Parse(); err != nil {
|
||||
return true, err
|
||||
}
|
||||
|
||||
subgroup := mtag.Get("group")
|
||||
|
||||
if len(subgroup) != 0 {
|
||||
ptrval := reflect.NewAt(realval.Type(), unsafe.Pointer(realval.UnsafeAddr()))
|
||||
description := mtag.Get("description")
|
||||
|
||||
group, err := g.AddGroup(subgroup, description, ptrval.Interface())
|
||||
if err != nil {
|
||||
return true, err
|
||||
}
|
||||
|
||||
group.Namespace = mtag.Get("namespace")
|
||||
|
||||
return true, nil
|
||||
}
|
||||
|
||||
return false, nil
|
||||
}
|
||||
|
||||
func (g *Group) scanType(handler scanHandler) error {
|
||||
// Get all the public fields in the data struct
|
||||
ptrval := reflect.ValueOf(g.data)
|
||||
|
||||
if ptrval.Type().Kind() != reflect.Ptr {
|
||||
panic(ErrNotPointerToStruct)
|
||||
}
|
||||
|
||||
stype := ptrval.Type().Elem()
|
||||
|
||||
if stype.Kind() != reflect.Struct {
|
||||
panic(ErrNotPointerToStruct)
|
||||
}
|
||||
|
||||
realval := reflect.Indirect(ptrval)
|
||||
|
||||
if err := g.scanStruct(realval, nil, handler); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := g.checkForDuplicateFlags(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (g *Group) scan() error {
|
||||
return g.scanType(g.scanSubGroupHandler)
|
||||
}
|
||||
|
||||
func (g *Group) groupByName(name string) *Group {
|
||||
if len(name) == 0 {
|
||||
return g
|
||||
}
|
||||
|
||||
return g.Find(name)
|
||||
}
|
||||
187
Godeps/_workspace/src/github.com/jessevdk/go-flags/group_test.go
generated
vendored
187
Godeps/_workspace/src/github.com/jessevdk/go-flags/group_test.go
generated
vendored
@@ -1,187 +0,0 @@
|
||||
package flags
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestGroupInline(t *testing.T) {
|
||||
var opts = struct {
|
||||
Value bool `short:"v"`
|
||||
|
||||
Group struct {
|
||||
G bool `short:"g"`
|
||||
} `group:"Grouped Options"`
|
||||
}{}
|
||||
|
||||
p, ret := assertParserSuccess(t, &opts, "-v", "-g")
|
||||
|
||||
assertStringArray(t, ret, []string{})
|
||||
|
||||
if !opts.Value {
|
||||
t.Errorf("Expected Value to be true")
|
||||
}
|
||||
|
||||
if !opts.Group.G {
|
||||
t.Errorf("Expected Group.G to be true")
|
||||
}
|
||||
|
||||
if p.Command.Group.Find("Grouped Options") == nil {
|
||||
t.Errorf("Expected to find group `Grouped Options'")
|
||||
}
|
||||
}
|
||||
|
||||
func TestGroupAdd(t *testing.T) {
|
||||
var opts = struct {
|
||||
Value bool `short:"v"`
|
||||
}{}
|
||||
|
||||
var grp = struct {
|
||||
G bool `short:"g"`
|
||||
}{}
|
||||
|
||||
p := NewParser(&opts, Default)
|
||||
g, err := p.AddGroup("Grouped Options", "", &grp)
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
ret, err := p.ParseArgs([]string{"-v", "-g", "rest"})
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
assertStringArray(t, ret, []string{"rest"})
|
||||
|
||||
if !opts.Value {
|
||||
t.Errorf("Expected Value to be true")
|
||||
}
|
||||
|
||||
if !grp.G {
|
||||
t.Errorf("Expected Group.G to be true")
|
||||
}
|
||||
|
||||
if p.Command.Group.Find("Grouped Options") != g {
|
||||
t.Errorf("Expected to find group `Grouped Options'")
|
||||
}
|
||||
|
||||
if p.Groups()[1] != g {
|
||||
t.Errorf("Expected group %#v, but got %#v", g, p.Groups()[0])
|
||||
}
|
||||
|
||||
if g.Options()[0].ShortName != 'g' {
|
||||
t.Errorf("Expected short name `g' but got %v", g.Options()[0].ShortName)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGroupNestedInline(t *testing.T) {
|
||||
var opts = struct {
|
||||
Value bool `short:"v"`
|
||||
|
||||
Group struct {
|
||||
G bool `short:"g"`
|
||||
|
||||
Nested struct {
|
||||
N string `long:"n"`
|
||||
} `group:"Nested Options"`
|
||||
} `group:"Grouped Options"`
|
||||
}{}
|
||||
|
||||
p, ret := assertParserSuccess(t, &opts, "-v", "-g", "--n", "n", "rest")
|
||||
|
||||
assertStringArray(t, ret, []string{"rest"})
|
||||
|
||||
if !opts.Value {
|
||||
t.Errorf("Expected Value to be true")
|
||||
}
|
||||
|
||||
if !opts.Group.G {
|
||||
t.Errorf("Expected Group.G to be true")
|
||||
}
|
||||
|
||||
assertString(t, opts.Group.Nested.N, "n")
|
||||
|
||||
if p.Command.Group.Find("Grouped Options") == nil {
|
||||
t.Errorf("Expected to find group `Grouped Options'")
|
||||
}
|
||||
|
||||
if p.Command.Group.Find("Nested Options") == nil {
|
||||
t.Errorf("Expected to find group `Nested Options'")
|
||||
}
|
||||
}
|
||||
|
||||
func TestGroupNestedInlineNamespace(t *testing.T) {
|
||||
var opts = struct {
|
||||
Opt string `long:"opt"`
|
||||
|
||||
Group struct {
|
||||
Opt string `long:"opt"`
|
||||
Group struct {
|
||||
Opt string `long:"opt"`
|
||||
} `group:"Subsubgroup" namespace:"sap"`
|
||||
} `group:"Subgroup" namespace:"sip"`
|
||||
}{}
|
||||
|
||||
p, ret := assertParserSuccess(t, &opts, "--opt", "a", "--sip.opt", "b", "--sip.sap.opt", "c", "rest")
|
||||
|
||||
assertStringArray(t, ret, []string{"rest"})
|
||||
|
||||
assertString(t, opts.Opt, "a")
|
||||
assertString(t, opts.Group.Opt, "b")
|
||||
assertString(t, opts.Group.Group.Opt, "c")
|
||||
|
||||
for _, name := range []string{"Subgroup", "Subsubgroup"} {
|
||||
if p.Command.Group.Find(name) == nil {
|
||||
t.Errorf("Expected to find group '%s'", name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestDuplicateShortFlags(t *testing.T) {
|
||||
var opts struct {
|
||||
Verbose []bool `short:"v" long:"verbose" description:"Show verbose debug information"`
|
||||
Variables []string `short:"v" long:"variable" description:"Set a variable value."`
|
||||
}
|
||||
|
||||
args := []string{
|
||||
"--verbose",
|
||||
"-v", "123",
|
||||
"-v", "456",
|
||||
}
|
||||
|
||||
_, err := ParseArgs(&opts, args)
|
||||
|
||||
if err == nil {
|
||||
t.Errorf("Expected an error with type ErrDuplicatedFlag")
|
||||
} else {
|
||||
err2 := err.(*Error)
|
||||
if err2.Type != ErrDuplicatedFlag {
|
||||
t.Errorf("Expected an error with type ErrDuplicatedFlag")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestDuplicateLongFlags(t *testing.T) {
|
||||
var opts struct {
|
||||
Test1 []bool `short:"a" long:"testing" description:"Test 1"`
|
||||
Test2 []string `short:"b" long:"testing" description:"Test 2."`
|
||||
}
|
||||
|
||||
args := []string{
|
||||
"--testing",
|
||||
}
|
||||
|
||||
_, err := ParseArgs(&opts, args)
|
||||
|
||||
if err == nil {
|
||||
t.Errorf("Expected an error with type ErrDuplicatedFlag")
|
||||
} else {
|
||||
err2 := err.(*Error)
|
||||
if err2.Type != ErrDuplicatedFlag {
|
||||
t.Errorf("Expected an error with type ErrDuplicatedFlag")
|
||||
}
|
||||
}
|
||||
}
|
||||
426
Godeps/_workspace/src/github.com/jessevdk/go-flags/help.go
generated
vendored
426
Godeps/_workspace/src/github.com/jessevdk/go-flags/help.go
generated
vendored
@@ -1,426 +0,0 @@
|
||||
// Copyright 2012 Jesse van den Kieboom. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package flags
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"reflect"
|
||||
"runtime"
|
||||
"strings"
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
||||
type alignmentInfo struct {
|
||||
maxLongLen int
|
||||
hasShort bool
|
||||
hasValueName bool
|
||||
terminalColumns int
|
||||
indent bool
|
||||
}
|
||||
|
||||
const (
|
||||
paddingBeforeOption = 2
|
||||
distanceBetweenOptionAndDescription = 2
|
||||
)
|
||||
|
||||
func (a *alignmentInfo) descriptionStart() int {
|
||||
ret := a.maxLongLen + distanceBetweenOptionAndDescription
|
||||
|
||||
if a.hasShort {
|
||||
ret += 2
|
||||
}
|
||||
|
||||
if a.maxLongLen > 0 {
|
||||
ret += 4
|
||||
}
|
||||
|
||||
if a.hasValueName {
|
||||
ret += 3
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
func (a *alignmentInfo) updateLen(name string, indent bool) {
|
||||
l := utf8.RuneCountInString(name)
|
||||
|
||||
if indent {
|
||||
l = l + 4
|
||||
}
|
||||
|
||||
if l > a.maxLongLen {
|
||||
a.maxLongLen = l
|
||||
}
|
||||
}
|
||||
|
||||
func (p *Parser) getAlignmentInfo() alignmentInfo {
|
||||
ret := alignmentInfo{
|
||||
maxLongLen: 0,
|
||||
hasShort: false,
|
||||
hasValueName: false,
|
||||
terminalColumns: getTerminalColumns(),
|
||||
}
|
||||
|
||||
if ret.terminalColumns <= 0 {
|
||||
ret.terminalColumns = 80
|
||||
}
|
||||
|
||||
var prevcmd *Command
|
||||
|
||||
p.eachActiveGroup(func(c *Command, grp *Group) {
|
||||
if c != prevcmd {
|
||||
for _, arg := range c.args {
|
||||
ret.updateLen(arg.Name, c != p.Command)
|
||||
}
|
||||
}
|
||||
|
||||
for _, info := range grp.options {
|
||||
if !info.canCli() {
|
||||
continue
|
||||
}
|
||||
|
||||
if info.ShortName != 0 {
|
||||
ret.hasShort = true
|
||||
}
|
||||
|
||||
if len(info.ValueName) > 0 {
|
||||
ret.hasValueName = true
|
||||
}
|
||||
|
||||
ret.updateLen(info.LongNameWithNamespace()+info.ValueName, c != p.Command)
|
||||
}
|
||||
})
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
func (p *Parser) writeHelpOption(writer *bufio.Writer, option *Option, info alignmentInfo) {
|
||||
line := &bytes.Buffer{}
|
||||
|
||||
prefix := paddingBeforeOption
|
||||
|
||||
if info.indent {
|
||||
prefix += 4
|
||||
}
|
||||
|
||||
line.WriteString(strings.Repeat(" ", prefix))
|
||||
|
||||
if option.ShortName != 0 {
|
||||
line.WriteRune(defaultShortOptDelimiter)
|
||||
line.WriteRune(option.ShortName)
|
||||
} else if info.hasShort {
|
||||
line.WriteString(" ")
|
||||
}
|
||||
|
||||
descstart := info.descriptionStart() + paddingBeforeOption
|
||||
|
||||
if len(option.LongName) > 0 {
|
||||
if option.ShortName != 0 {
|
||||
line.WriteString(", ")
|
||||
} else if info.hasShort {
|
||||
line.WriteString(" ")
|
||||
}
|
||||
|
||||
line.WriteString(defaultLongOptDelimiter)
|
||||
line.WriteString(option.LongNameWithNamespace())
|
||||
}
|
||||
|
||||
if option.canArgument() {
|
||||
line.WriteRune(defaultNameArgDelimiter)
|
||||
|
||||
if len(option.ValueName) > 0 {
|
||||
line.WriteString(option.ValueName)
|
||||
}
|
||||
}
|
||||
|
||||
written := line.Len()
|
||||
line.WriteTo(writer)
|
||||
|
||||
if option.Description != "" {
|
||||
dw := descstart - written
|
||||
writer.WriteString(strings.Repeat(" ", dw))
|
||||
|
||||
def := ""
|
||||
defs := option.Default
|
||||
|
||||
if len(option.DefaultMask) != 0 {
|
||||
if option.DefaultMask != "-" {
|
||||
def = option.DefaultMask
|
||||
}
|
||||
} else if len(defs) == 0 && option.canArgument() {
|
||||
var showdef bool
|
||||
|
||||
switch option.field.Type.Kind() {
|
||||
case reflect.Func, reflect.Ptr:
|
||||
showdef = !option.value.IsNil()
|
||||
case reflect.Slice, reflect.String, reflect.Array:
|
||||
showdef = option.value.Len() > 0
|
||||
case reflect.Map:
|
||||
showdef = !option.value.IsNil() && option.value.Len() > 0
|
||||
default:
|
||||
zeroval := reflect.Zero(option.field.Type)
|
||||
showdef = !reflect.DeepEqual(zeroval.Interface(), option.value.Interface())
|
||||
}
|
||||
|
||||
if showdef {
|
||||
def, _ = convertToString(option.value, option.tag)
|
||||
}
|
||||
} else if len(defs) != 0 {
|
||||
l := len(defs) - 1
|
||||
|
||||
for i := 0; i < l; i++ {
|
||||
def += quoteIfNeeded(defs[i]) + ", "
|
||||
}
|
||||
|
||||
def += quoteIfNeeded(defs[l])
|
||||
}
|
||||
|
||||
var envDef string
|
||||
if option.EnvDefaultKey != "" {
|
||||
var envPrintable string
|
||||
if runtime.GOOS == "windows" {
|
||||
envPrintable = "%" + option.EnvDefaultKey + "%"
|
||||
} else {
|
||||
envPrintable = "$" + option.EnvDefaultKey
|
||||
}
|
||||
envDef = fmt.Sprintf(" [%s]", envPrintable)
|
||||
}
|
||||
|
||||
var desc string
|
||||
|
||||
if def != "" {
|
||||
desc = fmt.Sprintf("%s (%v)%s", option.Description, def, envDef)
|
||||
} else {
|
||||
desc = option.Description + envDef
|
||||
}
|
||||
|
||||
writer.WriteString(wrapText(desc,
|
||||
info.terminalColumns-descstart,
|
||||
strings.Repeat(" ", descstart)))
|
||||
}
|
||||
|
||||
writer.WriteString("\n")
|
||||
}
|
||||
|
||||
func maxCommandLength(s []*Command) int {
|
||||
if len(s) == 0 {
|
||||
return 0
|
||||
}
|
||||
|
||||
ret := len(s[0].Name)
|
||||
|
||||
for _, v := range s[1:] {
|
||||
l := len(v.Name)
|
||||
|
||||
if l > ret {
|
||||
ret = l
|
||||
}
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
// WriteHelp writes a help message containing all the possible options and
|
||||
// their descriptions to the provided writer. Note that the HelpFlag parser
|
||||
// option provides a convenient way to add a -h/--help option group to the
|
||||
// command line parser which will automatically show the help messages using
|
||||
// this method.
|
||||
func (p *Parser) WriteHelp(writer io.Writer) {
|
||||
if writer == nil {
|
||||
return
|
||||
}
|
||||
|
||||
wr := bufio.NewWriter(writer)
|
||||
aligninfo := p.getAlignmentInfo()
|
||||
|
||||
cmd := p.Command
|
||||
|
||||
for cmd.Active != nil {
|
||||
cmd = cmd.Active
|
||||
}
|
||||
|
||||
if p.Name != "" {
|
||||
wr.WriteString("Usage:\n")
|
||||
wr.WriteString(" ")
|
||||
|
||||
allcmd := p.Command
|
||||
|
||||
for allcmd != nil {
|
||||
var usage string
|
||||
|
||||
if allcmd == p.Command {
|
||||
if len(p.Usage) != 0 {
|
||||
usage = p.Usage
|
||||
} else if p.Options&HelpFlag != 0 {
|
||||
usage = "[OPTIONS]"
|
||||
}
|
||||
} else if us, ok := allcmd.data.(Usage); ok {
|
||||
usage = us.Usage()
|
||||
} else if allcmd.hasCliOptions() {
|
||||
usage = fmt.Sprintf("[%s-OPTIONS]", allcmd.Name)
|
||||
}
|
||||
|
||||
if len(usage) != 0 {
|
||||
fmt.Fprintf(wr, " %s %s", allcmd.Name, usage)
|
||||
} else {
|
||||
fmt.Fprintf(wr, " %s", allcmd.Name)
|
||||
}
|
||||
|
||||
if len(allcmd.args) > 0 {
|
||||
fmt.Fprintf(wr, " ")
|
||||
}
|
||||
|
||||
for i, arg := range allcmd.args {
|
||||
if i != 0 {
|
||||
fmt.Fprintf(wr, " ")
|
||||
}
|
||||
|
||||
name := arg.Name
|
||||
|
||||
if arg.isRemaining() {
|
||||
name = name + "..."
|
||||
}
|
||||
|
||||
if !allcmd.ArgsRequired {
|
||||
fmt.Fprintf(wr, "[%s]", name)
|
||||
} else {
|
||||
fmt.Fprintf(wr, "%s", name)
|
||||
}
|
||||
}
|
||||
|
||||
if allcmd.Active == nil && len(allcmd.commands) > 0 {
|
||||
var co, cc string
|
||||
|
||||
if allcmd.SubcommandsOptional {
|
||||
co, cc = "[", "]"
|
||||
} else {
|
||||
co, cc = "<", ">"
|
||||
}
|
||||
|
||||
if len(allcmd.commands) > 3 {
|
||||
fmt.Fprintf(wr, " %scommand%s", co, cc)
|
||||
} else {
|
||||
subcommands := allcmd.sortedCommands()
|
||||
names := make([]string, len(subcommands))
|
||||
|
||||
for i, subc := range subcommands {
|
||||
names[i] = subc.Name
|
||||
}
|
||||
|
||||
fmt.Fprintf(wr, " %s%s%s", co, strings.Join(names, " | "), cc)
|
||||
}
|
||||
}
|
||||
|
||||
allcmd = allcmd.Active
|
||||
}
|
||||
|
||||
fmt.Fprintln(wr)
|
||||
|
||||
if len(cmd.LongDescription) != 0 {
|
||||
fmt.Fprintln(wr)
|
||||
|
||||
t := wrapText(cmd.LongDescription,
|
||||
aligninfo.terminalColumns,
|
||||
"")
|
||||
|
||||
fmt.Fprintln(wr, t)
|
||||
}
|
||||
}
|
||||
|
||||
c := p.Command
|
||||
|
||||
for c != nil {
|
||||
printcmd := c != p.Command
|
||||
|
||||
c.eachGroup(func(grp *Group) {
|
||||
first := true
|
||||
|
||||
// Skip built-in help group for all commands except the top-level
|
||||
// parser
|
||||
if grp.isBuiltinHelp && c != p.Command {
|
||||
return
|
||||
}
|
||||
|
||||
for _, info := range grp.options {
|
||||
if !info.canCli() {
|
||||
continue
|
||||
}
|
||||
|
||||
if printcmd {
|
||||
fmt.Fprintf(wr, "\n[%s command options]\n", c.Name)
|
||||
aligninfo.indent = true
|
||||
printcmd = false
|
||||
}
|
||||
|
||||
if first && cmd.Group != grp {
|
||||
fmt.Fprintln(wr)
|
||||
|
||||
if aligninfo.indent {
|
||||
wr.WriteString(" ")
|
||||
}
|
||||
|
||||
fmt.Fprintf(wr, "%s:\n", grp.ShortDescription)
|
||||
first = false
|
||||
}
|
||||
|
||||
p.writeHelpOption(wr, info, aligninfo)
|
||||
}
|
||||
})
|
||||
|
||||
if len(c.args) > 0 {
|
||||
if c == p.Command {
|
||||
fmt.Fprintf(wr, "\nArguments:\n")
|
||||
} else {
|
||||
fmt.Fprintf(wr, "\n[%s command arguments]\n", c.Name)
|
||||
}
|
||||
|
||||
maxlen := aligninfo.descriptionStart()
|
||||
|
||||
for _, arg := range c.args {
|
||||
prefix := strings.Repeat(" ", paddingBeforeOption)
|
||||
fmt.Fprintf(wr, "%s%s", prefix, arg.Name)
|
||||
|
||||
if len(arg.Description) > 0 {
|
||||
align := strings.Repeat(" ", maxlen-len(arg.Name)-1)
|
||||
fmt.Fprintf(wr, ":%s%s", align, arg.Description)
|
||||
}
|
||||
|
||||
fmt.Fprintln(wr)
|
||||
}
|
||||
}
|
||||
|
||||
c = c.Active
|
||||
}
|
||||
|
||||
scommands := cmd.sortedCommands()
|
||||
|
||||
if len(scommands) > 0 {
|
||||
maxnamelen := maxCommandLength(scommands)
|
||||
|
||||
fmt.Fprintln(wr)
|
||||
fmt.Fprintln(wr, "Available commands:")
|
||||
|
||||
for _, c := range scommands {
|
||||
fmt.Fprintf(wr, " %s", c.Name)
|
||||
|
||||
if len(c.ShortDescription) > 0 {
|
||||
pad := strings.Repeat(" ", maxnamelen-len(c.Name))
|
||||
fmt.Fprintf(wr, "%s %s", pad, c.ShortDescription)
|
||||
|
||||
if len(c.Aliases) > 0 {
|
||||
fmt.Fprintf(wr, " (aliases: %s)", strings.Join(c.Aliases, ", "))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fmt.Fprintln(wr)
|
||||
}
|
||||
}
|
||||
|
||||
wr.Flush()
|
||||
}
|
||||
300
Godeps/_workspace/src/github.com/jessevdk/go-flags/help_test.go
generated
vendored
300
Godeps/_workspace/src/github.com/jessevdk/go-flags/help_test.go
generated
vendored
@@ -1,300 +0,0 @@
|
||||
package flags
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"os"
|
||||
"runtime"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
type helpOptions struct {
|
||||
Verbose []bool `short:"v" long:"verbose" description:"Show verbose debug information" ini-name:"verbose"`
|
||||
Call func(string) `short:"c" description:"Call phone number" ini-name:"call"`
|
||||
PtrSlice []*string `long:"ptrslice" description:"A slice of pointers to string"`
|
||||
EmptyDescription bool `long:"empty-description"`
|
||||
|
||||
Default string `long:"default" default:"Some\nvalue" description:"Test default value"`
|
||||
DefaultArray []string `long:"default-array" default:"Some value" default:"Other\tvalue" description:"Test default array value"`
|
||||
DefaultMap map[string]string `long:"default-map" default:"some:value" default:"another:value" description:"Testdefault map value"`
|
||||
EnvDefault1 string `long:"env-default1" default:"Some value" env:"ENV_DEFAULT" description:"Test env-default1 value"`
|
||||
EnvDefault2 string `long:"env-default2" env:"ENV_DEFAULT" description:"Test env-default2 value"`
|
||||
OptionWithArgName string `long:"opt-with-arg-name" value-name:"something" description:"Option with named argument"`
|
||||
|
||||
OnlyIni string `ini-name:"only-ini" description:"Option only available in ini"`
|
||||
|
||||
Other struct {
|
||||
StringSlice []string `short:"s" default:"some" default:"value" description:"A slice of strings"`
|
||||
IntMap map[string]int `long:"intmap" default:"a:1" description:"A map from string to int" ini-name:"int-map"`
|
||||
} `group:"Other Options"`
|
||||
|
||||
Group struct {
|
||||
Opt string `long:"opt" description:"This is a subgroup option"`
|
||||
|
||||
Group struct {
|
||||
Opt string `long:"opt" description:"This is a subsubgroup option"`
|
||||
} `group:"Subsubgroup" namespace:"sap"`
|
||||
} `group:"Subgroup" namespace:"sip"`
|
||||
|
||||
Command struct {
|
||||
ExtraVerbose []bool `long:"extra-verbose" description:"Use for extra verbosity"`
|
||||
} `command:"command" alias:"cm" alias:"cmd" description:"A command"`
|
||||
|
||||
Args struct {
|
||||
Filename string `positional-arg-name:"filename" description:"A filename"`
|
||||
Number int `positional-arg-name:"num" description:"A number"`
|
||||
} `positional-args:"yes"`
|
||||
}
|
||||
|
||||
func TestHelp(t *testing.T) {
|
||||
oldEnv := EnvSnapshot()
|
||||
defer oldEnv.Restore()
|
||||
os.Setenv("ENV_DEFAULT", "env-def")
|
||||
|
||||
var opts helpOptions
|
||||
p := NewNamedParser("TestHelp", HelpFlag)
|
||||
p.AddGroup("Application Options", "The application options", &opts)
|
||||
|
||||
_, err := p.ParseArgs([]string{"--help"})
|
||||
|
||||
if err == nil {
|
||||
t.Fatalf("Expected help error")
|
||||
}
|
||||
|
||||
if e, ok := err.(*Error); !ok {
|
||||
t.Fatalf("Expected flags.Error, but got %T", err)
|
||||
} else {
|
||||
if e.Type != ErrHelp {
|
||||
t.Errorf("Expected flags.ErrHelp type, but got %s", e.Type)
|
||||
}
|
||||
|
||||
var expected string
|
||||
|
||||
if runtime.GOOS == "windows" {
|
||||
expected = `Usage:
|
||||
TestHelp [OPTIONS] [filename] [num] <command>
|
||||
|
||||
Application Options:
|
||||
/v, /verbose Show verbose debug information
|
||||
/c: Call phone number
|
||||
/ptrslice: A slice of pointers to string
|
||||
/empty-description
|
||||
/default: Test default value ("Some\nvalue")
|
||||
/default-array: Test default array value (Some value, "Other\tvalue")
|
||||
/default-map: Testdefault map value (some:value, another:value)
|
||||
/env-default1: Test env-default1 value (Some value) [%ENV_DEFAULT%]
|
||||
/env-default2: Test env-default2 value [%ENV_DEFAULT%]
|
||||
/opt-with-arg-name:something Option with named argument
|
||||
|
||||
Other Options:
|
||||
/s: A slice of strings (some, value)
|
||||
/intmap: A map from string to int (a:1)
|
||||
|
||||
Subgroup:
|
||||
/sip.opt: This is a subgroup option
|
||||
|
||||
Subsubgroup:
|
||||
/sip.sap.opt: This is a subsubgroup option
|
||||
|
||||
Help Options:
|
||||
/? Show this help message
|
||||
/h, /help Show this help message
|
||||
|
||||
Arguments:
|
||||
filename: A filename
|
||||
num: A number
|
||||
|
||||
Available commands:
|
||||
command A command (aliases: cm, cmd)
|
||||
`
|
||||
} else {
|
||||
expected = `Usage:
|
||||
TestHelp [OPTIONS] [filename] [num] <command>
|
||||
|
||||
Application Options:
|
||||
-v, --verbose Show verbose debug information
|
||||
-c= Call phone number
|
||||
--ptrslice= A slice of pointers to string
|
||||
--empty-description
|
||||
--default= Test default value ("Some\nvalue")
|
||||
--default-array= Test default array value (Some value,
|
||||
"Other\tvalue")
|
||||
--default-map= Testdefault map value (some:value,
|
||||
another:value)
|
||||
--env-default1= Test env-default1 value (Some value)
|
||||
[$ENV_DEFAULT]
|
||||
--env-default2= Test env-default2 value [$ENV_DEFAULT]
|
||||
--opt-with-arg-name=something Option with named argument
|
||||
|
||||
Other Options:
|
||||
-s= A slice of strings (some, value)
|
||||
--intmap= A map from string to int (a:1)
|
||||
|
||||
Subgroup:
|
||||
--sip.opt= This is a subgroup option
|
||||
|
||||
Subsubgroup:
|
||||
--sip.sap.opt= This is a subsubgroup option
|
||||
|
||||
Help Options:
|
||||
-h, --help Show this help message
|
||||
|
||||
Arguments:
|
||||
filename: A filename
|
||||
num: A number
|
||||
|
||||
Available commands:
|
||||
command A command (aliases: cm, cmd)
|
||||
`
|
||||
}
|
||||
|
||||
assertDiff(t, e.Message, expected, "help message")
|
||||
}
|
||||
}
|
||||
|
||||
func TestMan(t *testing.T) {
|
||||
oldEnv := EnvSnapshot()
|
||||
defer oldEnv.Restore()
|
||||
os.Setenv("ENV_DEFAULT", "env-def")
|
||||
|
||||
var opts helpOptions
|
||||
p := NewNamedParser("TestMan", HelpFlag)
|
||||
p.ShortDescription = "Test manpage generation"
|
||||
p.LongDescription = "This is a somewhat `longer' description of what this does"
|
||||
p.AddGroup("Application Options", "The application options", &opts)
|
||||
|
||||
p.Commands()[0].LongDescription = "Longer `command' description"
|
||||
|
||||
var buf bytes.Buffer
|
||||
p.WriteManPage(&buf)
|
||||
|
||||
got := buf.String()
|
||||
|
||||
tt := time.Now()
|
||||
|
||||
var envDefaultName string
|
||||
|
||||
if runtime.GOOS == "windows" {
|
||||
envDefaultName = "%ENV_DEFAULT%"
|
||||
} else {
|
||||
envDefaultName = "$ENV_DEFAULT"
|
||||
}
|
||||
|
||||
expected := fmt.Sprintf(`.TH TestMan 1 "%s"
|
||||
.SH NAME
|
||||
TestMan \- Test manpage generation
|
||||
.SH SYNOPSIS
|
||||
\fBTestMan\fP [OPTIONS]
|
||||
.SH DESCRIPTION
|
||||
This is a somewhat \fBlonger\fP description of what this does
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
\fB\fB\-v\fR, \fB\-\-verbose\fR\fP
|
||||
Show verbose debug information
|
||||
.TP
|
||||
\fB\fB\-c\fR\fP
|
||||
Call phone number
|
||||
.TP
|
||||
\fB\fB\-\-ptrslice\fR\fP
|
||||
A slice of pointers to string
|
||||
.TP
|
||||
\fB\fB\-\-empty-description\fR\fP
|
||||
.TP
|
||||
\fB\fB\-\-default\fR <default: \fI"Some\\nvalue"\fR>\fP
|
||||
Test default value
|
||||
.TP
|
||||
\fB\fB\-\-default-array\fR <default: \fI"Some value", "Other\\tvalue"\fR>\fP
|
||||
Test default array value
|
||||
.TP
|
||||
\fB\fB\-\-default-map\fR <default: \fI"some:value", "another:value"\fR>\fP
|
||||
Testdefault map value
|
||||
.TP
|
||||
\fB\fB\-\-env-default1\fR <default: \fI"Some value"\fR>\fP
|
||||
Test env-default1 value
|
||||
.TP
|
||||
\fB\fB\-\-env-default2\fR <default: \fI%s\fR>\fP
|
||||
Test env-default2 value
|
||||
.TP
|
||||
\fB\fB\-\-opt-with-arg-name\fR \fIsomething\fR\fP
|
||||
Option with named argument
|
||||
.TP
|
||||
\fB\fB\-s\fR <default: \fI"some", "value"\fR>\fP
|
||||
A slice of strings
|
||||
.TP
|
||||
\fB\fB\-\-intmap\fR <default: \fI"a:1"\fR>\fP
|
||||
A map from string to int
|
||||
.TP
|
||||
\fB\fB\-\-sip.opt\fR\fP
|
||||
This is a subgroup option
|
||||
.TP
|
||||
\fB\fB\-\-sip.sap.opt\fR\fP
|
||||
This is a subsubgroup option
|
||||
.SH COMMANDS
|
||||
.SS command
|
||||
A command
|
||||
|
||||
Longer \fBcommand\fP description
|
||||
|
||||
\fBUsage\fP: TestMan [OPTIONS] command [command-OPTIONS]
|
||||
|
||||
|
||||
\fBAliases\fP: cm, cmd
|
||||
|
||||
.TP
|
||||
\fB\fB\-\-extra-verbose\fR\fP
|
||||
Use for extra verbosity
|
||||
`, tt.Format("2 January 2006"), envDefaultName)
|
||||
|
||||
assertDiff(t, got, expected, "man page")
|
||||
}
|
||||
|
||||
type helpCommandNoOptions struct {
|
||||
Command struct {
|
||||
} `command:"command" description:"A command"`
|
||||
}
|
||||
|
||||
func TestHelpCommand(t *testing.T) {
|
||||
oldEnv := EnvSnapshot()
|
||||
defer oldEnv.Restore()
|
||||
os.Setenv("ENV_DEFAULT", "env-def")
|
||||
|
||||
var opts helpCommandNoOptions
|
||||
p := NewNamedParser("TestHelpCommand", HelpFlag)
|
||||
p.AddGroup("Application Options", "The application options", &opts)
|
||||
|
||||
_, err := p.ParseArgs([]string{"command", "--help"})
|
||||
|
||||
if err == nil {
|
||||
t.Fatalf("Expected help error")
|
||||
}
|
||||
|
||||
if e, ok := err.(*Error); !ok {
|
||||
t.Fatalf("Expected flags.Error, but got %T", err)
|
||||
} else {
|
||||
if e.Type != ErrHelp {
|
||||
t.Errorf("Expected flags.ErrHelp type, but got %s", e.Type)
|
||||
}
|
||||
|
||||
var expected string
|
||||
|
||||
if runtime.GOOS == "windows" {
|
||||
expected = `Usage:
|
||||
TestHelpCommand [OPTIONS] command
|
||||
|
||||
Help Options:
|
||||
/? Show this help message
|
||||
/h, /help Show this help message
|
||||
`
|
||||
} else {
|
||||
expected = `Usage:
|
||||
TestHelpCommand [OPTIONS] command
|
||||
|
||||
Help Options:
|
||||
-h, --help Show this help message
|
||||
`
|
||||
}
|
||||
|
||||
assertDiff(t, e.Message, expected, "help message")
|
||||
}
|
||||
}
|
||||
140
Godeps/_workspace/src/github.com/jessevdk/go-flags/ini.go
generated
vendored
140
Godeps/_workspace/src/github.com/jessevdk/go-flags/ini.go
generated
vendored
@@ -1,140 +0,0 @@
|
||||
package flags
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
)
|
||||
|
||||
// IniError contains location information on where an error occured.
|
||||
type IniError struct {
|
||||
// The error message.
|
||||
Message string
|
||||
|
||||
// The filename of the file in which the error occurred.
|
||||
File string
|
||||
|
||||
// The line number at which the error occurred.
|
||||
LineNumber uint
|
||||
}
|
||||
|
||||
// Error provides a "file:line: message" formatted message of the ini error.
|
||||
func (x *IniError) Error() string {
|
||||
return fmt.Sprintf(
|
||||
"%s:%d: %s",
|
||||
x.File,
|
||||
x.LineNumber,
|
||||
x.Message,
|
||||
)
|
||||
}
|
||||
|
||||
// IniOptions for writing
|
||||
type IniOptions uint
|
||||
|
||||
const (
|
||||
// IniNone indicates no options.
|
||||
IniNone IniOptions = 0
|
||||
|
||||
// IniIncludeDefaults indicates that default values should be written.
|
||||
IniIncludeDefaults = 1 << iota
|
||||
|
||||
// IniCommentDefaults indicates that if IniIncludeDefaults is used
|
||||
// options with default values are written but commented out.
|
||||
IniCommentDefaults
|
||||
|
||||
// IniIncludeComments indicates that comments containing the description
|
||||
// of an option should be written.
|
||||
IniIncludeComments
|
||||
|
||||
// IniDefault provides a default set of options.
|
||||
IniDefault = IniIncludeComments
|
||||
)
|
||||
|
||||
// IniParser is a utility to read and write flags options from and to ini
|
||||
// formatted strings.
|
||||
type IniParser struct {
|
||||
parser *Parser
|
||||
}
|
||||
|
||||
// NewIniParser creates a new ini parser for a given Parser.
|
||||
func NewIniParser(p *Parser) *IniParser {
|
||||
return &IniParser{
|
||||
parser: p,
|
||||
}
|
||||
}
|
||||
|
||||
// IniParse is a convenience function to parse command line options with default
|
||||
// settings from an ini formatted file. The provided data is a pointer to a struct
|
||||
// representing the default option group (named "Application Options"). For
|
||||
// more control, use flags.NewParser.
|
||||
func IniParse(filename string, data interface{}) error {
|
||||
p := NewParser(data, Default)
|
||||
|
||||
return NewIniParser(p).ParseFile(filename)
|
||||
}
|
||||
|
||||
// ParseFile parses flags from an ini formatted file. See Parse for more
|
||||
// information on the ini file format. The returned errors can be of the type
|
||||
// flags.Error or flags.IniError.
|
||||
func (i *IniParser) ParseFile(filename string) error {
|
||||
i.parser.clearIsSet()
|
||||
|
||||
ini, err := readIniFromFile(filename)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return i.parse(ini)
|
||||
}
|
||||
|
||||
// Parse parses flags from an ini format. You can use ParseFile as a
|
||||
// convenience function to parse from a filename instead of a general
|
||||
// io.Reader.
|
||||
//
|
||||
// The format of the ini file is as follows:
|
||||
//
|
||||
// [Option group name]
|
||||
// option = value
|
||||
//
|
||||
// Each section in the ini file represents an option group or command in the
|
||||
// flags parser. The default flags parser option group (i.e. when using
|
||||
// flags.Parse) is named 'Application Options'. The ini option name is matched
|
||||
// in the following order:
|
||||
//
|
||||
// 1. Compared to the ini-name tag on the option struct field (if present)
|
||||
// 2. Compared to the struct field name
|
||||
// 3. Compared to the option long name (if present)
|
||||
// 4. Compared to the option short name (if present)
|
||||
//
|
||||
// Sections for nested groups and commands can be addressed using a dot `.'
|
||||
// namespacing notation (i.e [subcommand.Options]). Group section names are
|
||||
// matched case insensitive.
|
||||
//
|
||||
// The returned errors can be of the type flags.Error or flags.IniError.
|
||||
func (i *IniParser) Parse(reader io.Reader) error {
|
||||
i.parser.clearIsSet()
|
||||
|
||||
ini, err := readIni(reader, "")
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return i.parse(ini)
|
||||
}
|
||||
|
||||
// WriteFile writes the flags as ini format into a file. See WriteIni
|
||||
// for more information. The returned error occurs when the specified file
|
||||
// could not be opened for writing.
|
||||
func (i *IniParser) WriteFile(filename string, options IniOptions) error {
|
||||
return writeIniToFile(i, filename, options)
|
||||
}
|
||||
|
||||
// Write writes the current values of all the flags to an ini format.
|
||||
// See Parse for more information on the ini file format. You typically
|
||||
// call this only after settings have been parsed since the default values of each
|
||||
// option are stored just before parsing the flags (this is only relevant when
|
||||
// IniIncludeDefaults is _not_ set in options).
|
||||
func (i *IniParser) Write(writer io.Writer, options IniOptions) {
|
||||
writeIni(i, writer, options)
|
||||
}
|
||||
452
Godeps/_workspace/src/github.com/jessevdk/go-flags/ini_private.go
generated
vendored
452
Godeps/_workspace/src/github.com/jessevdk/go-flags/ini_private.go
generated
vendored
@@ -1,452 +0,0 @@
|
||||
package flags
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"reflect"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type iniValue struct {
|
||||
Name string
|
||||
Value string
|
||||
Quoted bool
|
||||
LineNumber uint
|
||||
}
|
||||
|
||||
type iniSection []iniValue
|
||||
type ini struct {
|
||||
File string
|
||||
Sections map[string]iniSection
|
||||
}
|
||||
|
||||
func readFullLine(reader *bufio.Reader) (string, error) {
|
||||
var line []byte
|
||||
|
||||
for {
|
||||
l, more, err := reader.ReadLine()
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if line == nil && !more {
|
||||
return string(l), nil
|
||||
}
|
||||
|
||||
line = append(line, l...)
|
||||
|
||||
if !more {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return string(line), nil
|
||||
}
|
||||
|
||||
func optionIniName(option *Option) string {
|
||||
name := option.tag.Get("_read-ini-name")
|
||||
|
||||
if len(name) != 0 {
|
||||
return name
|
||||
}
|
||||
|
||||
name = option.tag.Get("ini-name")
|
||||
|
||||
if len(name) != 0 {
|
||||
return name
|
||||
}
|
||||
|
||||
return option.field.Name
|
||||
}
|
||||
|
||||
func writeGroupIni(cmd *Command, group *Group, namespace string, writer io.Writer, options IniOptions) {
|
||||
var sname string
|
||||
|
||||
if len(namespace) != 0 {
|
||||
sname = namespace
|
||||
}
|
||||
|
||||
if cmd.Group != group && len(group.ShortDescription) != 0 {
|
||||
if len(sname) != 0 {
|
||||
sname += "."
|
||||
}
|
||||
|
||||
sname += group.ShortDescription
|
||||
}
|
||||
|
||||
sectionwritten := false
|
||||
comments := (options & IniIncludeComments) != IniNone
|
||||
|
||||
for _, option := range group.options {
|
||||
if option.isFunc() {
|
||||
continue
|
||||
}
|
||||
|
||||
if len(option.tag.Get("no-ini")) != 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
val := option.value
|
||||
|
||||
if (options&IniIncludeDefaults) == IniNone && option.valueIsDefault() {
|
||||
continue
|
||||
}
|
||||
|
||||
if !sectionwritten {
|
||||
fmt.Fprintf(writer, "[%s]\n", sname)
|
||||
sectionwritten = true
|
||||
}
|
||||
|
||||
if comments && len(option.Description) != 0 {
|
||||
fmt.Fprintf(writer, "; %s\n", option.Description)
|
||||
}
|
||||
|
||||
oname := optionIniName(option)
|
||||
|
||||
commentOption := (options&(IniIncludeDefaults|IniCommentDefaults)) == IniIncludeDefaults|IniCommentDefaults && option.valueIsDefault()
|
||||
|
||||
kind := val.Type().Kind()
|
||||
switch kind {
|
||||
case reflect.Slice:
|
||||
kind = val.Type().Elem().Kind()
|
||||
|
||||
if val.Len() == 0 {
|
||||
writeOption(writer, oname, kind, "", "", true, option.iniQuote)
|
||||
} else {
|
||||
for idx := 0; idx < val.Len(); idx++ {
|
||||
v, _ := convertToString(val.Index(idx), option.tag)
|
||||
|
||||
writeOption(writer, oname, kind, "", v, commentOption, option.iniQuote)
|
||||
}
|
||||
}
|
||||
case reflect.Map:
|
||||
kind = val.Type().Elem().Kind()
|
||||
|
||||
if val.Len() == 0 {
|
||||
writeOption(writer, oname, kind, "", "", true, option.iniQuote)
|
||||
} else {
|
||||
mkeys := val.MapKeys()
|
||||
keys := make([]string, len(val.MapKeys()))
|
||||
kkmap := make(map[string]reflect.Value)
|
||||
|
||||
for i, k := range mkeys {
|
||||
keys[i], _ = convertToString(k, option.tag)
|
||||
kkmap[keys[i]] = k
|
||||
}
|
||||
|
||||
sort.Strings(keys)
|
||||
|
||||
for _, k := range keys {
|
||||
v, _ := convertToString(val.MapIndex(kkmap[k]), option.tag)
|
||||
|
||||
writeOption(writer, oname, kind, k, v, commentOption, option.iniQuote)
|
||||
}
|
||||
}
|
||||
default:
|
||||
v, _ := convertToString(val, option.tag)
|
||||
|
||||
writeOption(writer, oname, kind, "", v, commentOption, option.iniQuote)
|
||||
}
|
||||
|
||||
if comments {
|
||||
fmt.Fprintln(writer)
|
||||
}
|
||||
}
|
||||
|
||||
if sectionwritten && !comments {
|
||||
fmt.Fprintln(writer)
|
||||
}
|
||||
}
|
||||
|
||||
func writeOption(writer io.Writer, optionName string, optionType reflect.Kind, optionKey string, optionValue string, commentOption bool, forceQuote bool) {
|
||||
if forceQuote || (optionType == reflect.String && !isPrint(optionValue)) {
|
||||
optionValue = strconv.Quote(optionValue)
|
||||
}
|
||||
|
||||
comment := ""
|
||||
if commentOption {
|
||||
comment = "; "
|
||||
}
|
||||
|
||||
fmt.Fprintf(writer, "%s%s =", comment, optionName)
|
||||
|
||||
if optionKey != "" {
|
||||
fmt.Fprintf(writer, " %s:%s", optionKey, optionValue)
|
||||
} else if optionValue != "" {
|
||||
fmt.Fprintf(writer, " %s", optionValue)
|
||||
}
|
||||
|
||||
fmt.Fprintln(writer)
|
||||
}
|
||||
|
||||
func writeCommandIni(command *Command, namespace string, writer io.Writer, options IniOptions) {
|
||||
command.eachGroup(func(group *Group) {
|
||||
writeGroupIni(command, group, namespace, writer, options)
|
||||
})
|
||||
|
||||
for _, c := range command.commands {
|
||||
var nns string
|
||||
|
||||
if len(namespace) != 0 {
|
||||
nns = c.Name + "." + nns
|
||||
} else {
|
||||
nns = c.Name
|
||||
}
|
||||
|
||||
writeCommandIni(c, nns, writer, options)
|
||||
}
|
||||
}
|
||||
|
||||
func writeIni(parser *IniParser, writer io.Writer, options IniOptions) {
|
||||
writeCommandIni(parser.parser.Command, "", writer, options)
|
||||
}
|
||||
|
||||
func writeIniToFile(parser *IniParser, filename string, options IniOptions) error {
|
||||
file, err := os.Create(filename)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
defer file.Close()
|
||||
|
||||
writeIni(parser, file, options)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func readIniFromFile(filename string) (*ini, error) {
|
||||
file, err := os.Open(filename)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
defer file.Close()
|
||||
|
||||
return readIni(file, filename)
|
||||
}
|
||||
|
||||
func readIni(contents io.Reader, filename string) (*ini, error) {
|
||||
ret := &ini{
|
||||
File: filename,
|
||||
Sections: make(map[string]iniSection),
|
||||
}
|
||||
|
||||
reader := bufio.NewReader(contents)
|
||||
|
||||
// Empty global section
|
||||
section := make(iniSection, 0, 10)
|
||||
sectionname := ""
|
||||
|
||||
ret.Sections[sectionname] = section
|
||||
|
||||
var lineno uint
|
||||
|
||||
for {
|
||||
line, err := readFullLine(reader)
|
||||
|
||||
if err == io.EOF {
|
||||
break
|
||||
} else if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
lineno++
|
||||
line = strings.TrimSpace(line)
|
||||
|
||||
// Skip empty lines and lines starting with ; (comments)
|
||||
if len(line) == 0 || line[0] == ';' || line[0] == '#' {
|
||||
continue
|
||||
}
|
||||
|
||||
if line[0] == '[' {
|
||||
if line[0] != '[' || line[len(line)-1] != ']' {
|
||||
return nil, &IniError{
|
||||
Message: "malformed section header",
|
||||
File: filename,
|
||||
LineNumber: lineno,
|
||||
}
|
||||
}
|
||||
|
||||
name := strings.TrimSpace(line[1 : len(line)-1])
|
||||
|
||||
if len(name) == 0 {
|
||||
return nil, &IniError{
|
||||
Message: "empty section name",
|
||||
File: filename,
|
||||
LineNumber: lineno,
|
||||
}
|
||||
}
|
||||
|
||||
sectionname = name
|
||||
section = ret.Sections[name]
|
||||
|
||||
if section == nil {
|
||||
section = make(iniSection, 0, 10)
|
||||
ret.Sections[name] = section
|
||||
}
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
// Parse option here
|
||||
keyval := strings.SplitN(line, "=", 2)
|
||||
|
||||
if len(keyval) != 2 {
|
||||
return nil, &IniError{
|
||||
Message: fmt.Sprintf("malformed key=value (%s)", line),
|
||||
File: filename,
|
||||
LineNumber: lineno,
|
||||
}
|
||||
}
|
||||
|
||||
name := strings.TrimSpace(keyval[0])
|
||||
value := strings.TrimSpace(keyval[1])
|
||||
quoted := false
|
||||
|
||||
if len(value) != 0 && value[0] == '"' {
|
||||
if v, err := strconv.Unquote(value); err == nil {
|
||||
value = v
|
||||
|
||||
quoted = true
|
||||
} else {
|
||||
return nil, &IniError{
|
||||
Message: err.Error(),
|
||||
File: filename,
|
||||
LineNumber: lineno,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
section = append(section, iniValue{
|
||||
Name: name,
|
||||
Value: value,
|
||||
Quoted: quoted,
|
||||
LineNumber: lineno,
|
||||
})
|
||||
|
||||
ret.Sections[sectionname] = section
|
||||
}
|
||||
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func (i *IniParser) matchingGroups(name string) []*Group {
|
||||
if len(name) == 0 {
|
||||
var ret []*Group
|
||||
|
||||
i.parser.eachGroup(func(g *Group) {
|
||||
ret = append(ret, g)
|
||||
})
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
g := i.parser.groupByName(name)
|
||||
|
||||
if g != nil {
|
||||
return []*Group{g}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (i *IniParser) parse(ini *ini) error {
|
||||
p := i.parser
|
||||
|
||||
var quotesLookup = make(map[*Option]bool)
|
||||
|
||||
for name, section := range ini.Sections {
|
||||
groups := i.matchingGroups(name)
|
||||
|
||||
if len(groups) == 0 {
|
||||
return newErrorf(ErrUnknownGroup, "could not find option group `%s'", name)
|
||||
}
|
||||
|
||||
for _, inival := range section {
|
||||
var opt *Option
|
||||
|
||||
for _, group := range groups {
|
||||
opt = group.optionByName(inival.Name, func(o *Option, n string) bool {
|
||||
return strings.ToLower(o.tag.Get("ini-name")) == strings.ToLower(n)
|
||||
})
|
||||
|
||||
if opt != nil && len(opt.tag.Get("no-ini")) != 0 {
|
||||
opt = nil
|
||||
}
|
||||
|
||||
if opt != nil {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if opt == nil {
|
||||
if (p.Options & IgnoreUnknown) == None {
|
||||
return &IniError{
|
||||
Message: fmt.Sprintf("unknown option: %s", inival.Name),
|
||||
File: ini.File,
|
||||
LineNumber: inival.LineNumber,
|
||||
}
|
||||
}
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
pval := &inival.Value
|
||||
|
||||
if !opt.canArgument() && len(inival.Value) == 0 {
|
||||
pval = nil
|
||||
} else {
|
||||
if opt.value.Type().Kind() == reflect.Map {
|
||||
parts := strings.SplitN(inival.Value, ":", 2)
|
||||
|
||||
// only handle unquoting
|
||||
if len(parts) == 2 && parts[1][0] == '"' {
|
||||
if v, err := strconv.Unquote(parts[1]); err == nil {
|
||||
parts[1] = v
|
||||
|
||||
inival.Quoted = true
|
||||
} else {
|
||||
return &IniError{
|
||||
Message: err.Error(),
|
||||
File: ini.File,
|
||||
LineNumber: inival.LineNumber,
|
||||
}
|
||||
}
|
||||
|
||||
s := parts[0] + ":" + parts[1]
|
||||
|
||||
pval = &s
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if err := opt.set(pval); err != nil {
|
||||
return &IniError{
|
||||
Message: err.Error(),
|
||||
File: ini.File,
|
||||
LineNumber: inival.LineNumber,
|
||||
}
|
||||
}
|
||||
|
||||
// either all INI values are quoted or only values who need quoting
|
||||
if _, ok := quotesLookup[opt]; !inival.Quoted || !ok {
|
||||
quotesLookup[opt] = inival.Quoted
|
||||
}
|
||||
|
||||
opt.tag.Set("_read-ini-name", inival.Name)
|
||||
}
|
||||
}
|
||||
|
||||
for opt, quoted := range quotesLookup {
|
||||
opt.iniQuote = quoted
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
767
Godeps/_workspace/src/github.com/jessevdk/go-flags/ini_test.go
generated
vendored
767
Godeps/_workspace/src/github.com/jessevdk/go-flags/ini_test.go
generated
vendored
@@ -1,767 +0,0 @@
|
||||
package flags
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestWriteIni(t *testing.T) {
|
||||
oldEnv := EnvSnapshot()
|
||||
defer oldEnv.Restore()
|
||||
os.Setenv("ENV_DEFAULT", "env-def")
|
||||
|
||||
var tests = []struct {
|
||||
args []string
|
||||
options IniOptions
|
||||
expected string
|
||||
}{
|
||||
{
|
||||
[]string{"-vv", "--intmap=a:2", "--intmap", "b:3", "filename", "0", "command"},
|
||||
IniDefault,
|
||||
`[Application Options]
|
||||
; Show verbose debug information
|
||||
verbose = true
|
||||
verbose = true
|
||||
|
||||
; Test env-default1 value
|
||||
EnvDefault1 = env-def
|
||||
|
||||
; Test env-default2 value
|
||||
EnvDefault2 = env-def
|
||||
|
||||
[Other Options]
|
||||
; A map from string to int
|
||||
int-map = a:2
|
||||
int-map = b:3
|
||||
|
||||
`,
|
||||
},
|
||||
{
|
||||
[]string{"-vv", "--intmap=a:2", "--intmap", "b:3", "filename", "0", "command"},
|
||||
IniDefault | IniIncludeDefaults,
|
||||
`[Application Options]
|
||||
; Show verbose debug information
|
||||
verbose = true
|
||||
verbose = true
|
||||
|
||||
; A slice of pointers to string
|
||||
; PtrSlice =
|
||||
|
||||
EmptyDescription = false
|
||||
|
||||
; Test default value
|
||||
Default = "Some\nvalue"
|
||||
|
||||
; Test default array value
|
||||
DefaultArray = Some value
|
||||
DefaultArray = "Other\tvalue"
|
||||
|
||||
; Testdefault map value
|
||||
DefaultMap = another:value
|
||||
DefaultMap = some:value
|
||||
|
||||
; Test env-default1 value
|
||||
EnvDefault1 = env-def
|
||||
|
||||
; Test env-default2 value
|
||||
EnvDefault2 = env-def
|
||||
|
||||
; Option with named argument
|
||||
OptionWithArgName =
|
||||
|
||||
; Option only available in ini
|
||||
only-ini =
|
||||
|
||||
[Other Options]
|
||||
; A slice of strings
|
||||
StringSlice = some
|
||||
StringSlice = value
|
||||
|
||||
; A map from string to int
|
||||
int-map = a:2
|
||||
int-map = b:3
|
||||
|
||||
[Subgroup]
|
||||
; This is a subgroup option
|
||||
Opt =
|
||||
|
||||
[Subsubgroup]
|
||||
; This is a subsubgroup option
|
||||
Opt =
|
||||
|
||||
[command]
|
||||
; Use for extra verbosity
|
||||
; ExtraVerbose =
|
||||
|
||||
`,
|
||||
},
|
||||
{
|
||||
[]string{"filename", "0", "command"},
|
||||
IniDefault | IniIncludeDefaults | IniCommentDefaults,
|
||||
`[Application Options]
|
||||
; Show verbose debug information
|
||||
; verbose =
|
||||
|
||||
; A slice of pointers to string
|
||||
; PtrSlice =
|
||||
|
||||
; EmptyDescription = false
|
||||
|
||||
; Test default value
|
||||
; Default = "Some\nvalue"
|
||||
|
||||
; Test default array value
|
||||
; DefaultArray = Some value
|
||||
; DefaultArray = "Other\tvalue"
|
||||
|
||||
; Testdefault map value
|
||||
; DefaultMap = another:value
|
||||
; DefaultMap = some:value
|
||||
|
||||
; Test env-default1 value
|
||||
EnvDefault1 = env-def
|
||||
|
||||
; Test env-default2 value
|
||||
EnvDefault2 = env-def
|
||||
|
||||
; Option with named argument
|
||||
; OptionWithArgName =
|
||||
|
||||
; Option only available in ini
|
||||
; only-ini =
|
||||
|
||||
[Other Options]
|
||||
; A slice of strings
|
||||
; StringSlice = some
|
||||
; StringSlice = value
|
||||
|
||||
; A map from string to int
|
||||
; int-map = a:1
|
||||
|
||||
[Subgroup]
|
||||
; This is a subgroup option
|
||||
; Opt =
|
||||
|
||||
[Subsubgroup]
|
||||
; This is a subsubgroup option
|
||||
; Opt =
|
||||
|
||||
[command]
|
||||
; Use for extra verbosity
|
||||
; ExtraVerbose =
|
||||
|
||||
`,
|
||||
},
|
||||
{
|
||||
[]string{"--default=New value", "--default-array=New value", "--default-map=new:value", "filename", "0", "command"},
|
||||
IniDefault | IniIncludeDefaults | IniCommentDefaults,
|
||||
`[Application Options]
|
||||
; Show verbose debug information
|
||||
; verbose =
|
||||
|
||||
; A slice of pointers to string
|
||||
; PtrSlice =
|
||||
|
||||
; EmptyDescription = false
|
||||
|
||||
; Test default value
|
||||
Default = New value
|
||||
|
||||
; Test default array value
|
||||
DefaultArray = New value
|
||||
|
||||
; Testdefault map value
|
||||
DefaultMap = new:value
|
||||
|
||||
; Test env-default1 value
|
||||
EnvDefault1 = env-def
|
||||
|
||||
; Test env-default2 value
|
||||
EnvDefault2 = env-def
|
||||
|
||||
; Option with named argument
|
||||
; OptionWithArgName =
|
||||
|
||||
; Option only available in ini
|
||||
; only-ini =
|
||||
|
||||
[Other Options]
|
||||
; A slice of strings
|
||||
; StringSlice = some
|
||||
; StringSlice = value
|
||||
|
||||
; A map from string to int
|
||||
; int-map = a:1
|
||||
|
||||
[Subgroup]
|
||||
; This is a subgroup option
|
||||
; Opt =
|
||||
|
||||
[Subsubgroup]
|
||||
; This is a subsubgroup option
|
||||
; Opt =
|
||||
|
||||
[command]
|
||||
; Use for extra verbosity
|
||||
; ExtraVerbose =
|
||||
|
||||
`,
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
var opts helpOptions
|
||||
|
||||
p := NewNamedParser("TestIni", Default)
|
||||
p.AddGroup("Application Options", "The application options", &opts)
|
||||
|
||||
_, err := p.ParseArgs(test.args)
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
}
|
||||
|
||||
inip := NewIniParser(p)
|
||||
|
||||
var b bytes.Buffer
|
||||
inip.Write(&b, test.options)
|
||||
|
||||
got := b.String()
|
||||
expected := test.expected
|
||||
|
||||
msg := fmt.Sprintf("with arguments %+v and ini options %b", test.args, test.options)
|
||||
assertDiff(t, got, expected, msg)
|
||||
}
|
||||
}
|
||||
|
||||
func TestReadIni(t *testing.T) {
|
||||
var opts helpOptions
|
||||
|
||||
p := NewNamedParser("TestIni", Default)
|
||||
p.AddGroup("Application Options", "The application options", &opts)
|
||||
|
||||
inip := NewIniParser(p)
|
||||
|
||||
inic := `
|
||||
; Show verbose debug information
|
||||
verbose = true
|
||||
verbose = true
|
||||
|
||||
DefaultMap = another:"value\n1"
|
||||
DefaultMap = some:value 2
|
||||
|
||||
[Application Options]
|
||||
; A slice of pointers to string
|
||||
; PtrSlice =
|
||||
|
||||
; Test default value
|
||||
Default = "New\nvalue"
|
||||
|
||||
; Test env-default1 value
|
||||
EnvDefault1 = New value
|
||||
|
||||
[Other Options]
|
||||
# A slice of strings
|
||||
StringSlice = "some\nvalue"
|
||||
StringSlice = another value
|
||||
|
||||
; A map from string to int
|
||||
int-map = a:2
|
||||
int-map = b:3
|
||||
|
||||
`
|
||||
|
||||
b := strings.NewReader(inic)
|
||||
err := inip.Parse(b)
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error: %s", err)
|
||||
}
|
||||
|
||||
assertBoolArray(t, opts.Verbose, []bool{true, true})
|
||||
|
||||
if v := map[string]string{"another": "value\n1", "some": "value 2"}; !reflect.DeepEqual(opts.DefaultMap, v) {
|
||||
t.Fatalf("Expected %#v for DefaultMap but got %#v", v, opts.DefaultMap)
|
||||
}
|
||||
|
||||
assertString(t, opts.Default, "New\nvalue")
|
||||
|
||||
assertString(t, opts.EnvDefault1, "New value")
|
||||
|
||||
assertStringArray(t, opts.Other.StringSlice, []string{"some\nvalue", "another value"})
|
||||
|
||||
if v, ok := opts.Other.IntMap["a"]; !ok {
|
||||
t.Errorf("Expected \"a\" in Other.IntMap")
|
||||
} else if v != 2 {
|
||||
t.Errorf("Expected Other.IntMap[\"a\"] = 2, but got %v", v)
|
||||
}
|
||||
|
||||
if v, ok := opts.Other.IntMap["b"]; !ok {
|
||||
t.Errorf("Expected \"b\" in Other.IntMap")
|
||||
} else if v != 3 {
|
||||
t.Errorf("Expected Other.IntMap[\"b\"] = 3, but got %v", v)
|
||||
}
|
||||
}
|
||||
|
||||
func TestReadAndWriteIni(t *testing.T) {
|
||||
var tests = []struct {
|
||||
options IniOptions
|
||||
read string
|
||||
write string
|
||||
}{
|
||||
{
|
||||
IniIncludeComments,
|
||||
`[Application Options]
|
||||
; Show verbose debug information
|
||||
verbose = true
|
||||
verbose = true
|
||||
|
||||
; Test default value
|
||||
Default = "quote me"
|
||||
|
||||
; Test default array value
|
||||
DefaultArray = 1
|
||||
DefaultArray = "2"
|
||||
DefaultArray = 3
|
||||
|
||||
; Testdefault map value
|
||||
; DefaultMap =
|
||||
|
||||
; Test env-default1 value
|
||||
EnvDefault1 = env-def
|
||||
|
||||
; Test env-default2 value
|
||||
EnvDefault2 = env-def
|
||||
|
||||
[Other Options]
|
||||
; A slice of strings
|
||||
; StringSlice =
|
||||
|
||||
; A map from string to int
|
||||
int-map = a:2
|
||||
int-map = b:"3"
|
||||
|
||||
`,
|
||||
`[Application Options]
|
||||
; Show verbose debug information
|
||||
verbose = true
|
||||
verbose = true
|
||||
|
||||
; Test default value
|
||||
Default = "quote me"
|
||||
|
||||
; Test default array value
|
||||
DefaultArray = 1
|
||||
DefaultArray = 2
|
||||
DefaultArray = 3
|
||||
|
||||
; Testdefault map value
|
||||
; DefaultMap =
|
||||
|
||||
; Test env-default1 value
|
||||
EnvDefault1 = env-def
|
||||
|
||||
; Test env-default2 value
|
||||
EnvDefault2 = env-def
|
||||
|
||||
[Other Options]
|
||||
; A slice of strings
|
||||
; StringSlice =
|
||||
|
||||
; A map from string to int
|
||||
int-map = a:2
|
||||
int-map = b:3
|
||||
|
||||
`,
|
||||
},
|
||||
{
|
||||
IniIncludeComments,
|
||||
`[Application Options]
|
||||
; Show verbose debug information
|
||||
verbose = true
|
||||
verbose = true
|
||||
|
||||
; Test default value
|
||||
Default = "quote me"
|
||||
|
||||
; Test default array value
|
||||
DefaultArray = "1"
|
||||
DefaultArray = "2"
|
||||
DefaultArray = "3"
|
||||
|
||||
; Testdefault map value
|
||||
; DefaultMap =
|
||||
|
||||
; Test env-default1 value
|
||||
EnvDefault1 = env-def
|
||||
|
||||
; Test env-default2 value
|
||||
EnvDefault2 = env-def
|
||||
|
||||
[Other Options]
|
||||
; A slice of strings
|
||||
; StringSlice =
|
||||
|
||||
; A map from string to int
|
||||
int-map = a:"2"
|
||||
int-map = b:"3"
|
||||
|
||||
`,
|
||||
`[Application Options]
|
||||
; Show verbose debug information
|
||||
verbose = true
|
||||
verbose = true
|
||||
|
||||
; Test default value
|
||||
Default = "quote me"
|
||||
|
||||
; Test default array value
|
||||
DefaultArray = "1"
|
||||
DefaultArray = "2"
|
||||
DefaultArray = "3"
|
||||
|
||||
; Testdefault map value
|
||||
; DefaultMap =
|
||||
|
||||
; Test env-default1 value
|
||||
EnvDefault1 = env-def
|
||||
|
||||
; Test env-default2 value
|
||||
EnvDefault2 = env-def
|
||||
|
||||
[Other Options]
|
||||
; A slice of strings
|
||||
; StringSlice =
|
||||
|
||||
; A map from string to int
|
||||
int-map = a:"2"
|
||||
int-map = b:"3"
|
||||
|
||||
`,
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
var opts helpOptions
|
||||
|
||||
p := NewNamedParser("TestIni", Default)
|
||||
p.AddGroup("Application Options", "The application options", &opts)
|
||||
|
||||
inip := NewIniParser(p)
|
||||
|
||||
read := strings.NewReader(test.read)
|
||||
err := inip.Parse(read)
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error: %s", err)
|
||||
}
|
||||
|
||||
var write bytes.Buffer
|
||||
inip.Write(&write, test.options)
|
||||
|
||||
got := write.String()
|
||||
|
||||
msg := fmt.Sprintf("with ini options %b", test.options)
|
||||
assertDiff(t, got, test.write, msg)
|
||||
}
|
||||
}
|
||||
|
||||
func TestReadIniWrongQuoting(t *testing.T) {
|
||||
var tests = []struct {
|
||||
iniFile string
|
||||
lineNumber uint
|
||||
}{
|
||||
{
|
||||
iniFile: `Default = "New\nvalue`,
|
||||
lineNumber: 1,
|
||||
},
|
||||
{
|
||||
iniFile: `StringSlice = "New\nvalue`,
|
||||
lineNumber: 1,
|
||||
},
|
||||
{
|
||||
iniFile: `StringSlice = "New\nvalue"
|
||||
StringSlice = "Second\nvalue`,
|
||||
lineNumber: 2,
|
||||
},
|
||||
{
|
||||
iniFile: `DefaultMap = some:"value`,
|
||||
lineNumber: 1,
|
||||
},
|
||||
{
|
||||
iniFile: `DefaultMap = some:value
|
||||
DefaultMap = another:"value`,
|
||||
lineNumber: 2,
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
var opts helpOptions
|
||||
|
||||
p := NewNamedParser("TestIni", Default)
|
||||
p.AddGroup("Application Options", "The application options", &opts)
|
||||
|
||||
inip := NewIniParser(p)
|
||||
|
||||
inic := test.iniFile
|
||||
|
||||
b := strings.NewReader(inic)
|
||||
err := inip.Parse(b)
|
||||
|
||||
if err == nil {
|
||||
t.Fatalf("Expect error")
|
||||
}
|
||||
|
||||
iniError := err.(*IniError)
|
||||
|
||||
if iniError.LineNumber != test.lineNumber {
|
||||
t.Fatalf("Expect error on line %d", test.lineNumber)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestIniCommands(t *testing.T) {
|
||||
var opts struct {
|
||||
Value string `short:"v" long:"value"`
|
||||
|
||||
Add struct {
|
||||
Name int `short:"n" long:"name" ini-name:"AliasName"`
|
||||
|
||||
Other struct {
|
||||
O string `short:"o" long:"other"`
|
||||
} `group:"Other Options"`
|
||||
} `command:"add"`
|
||||
}
|
||||
|
||||
p := NewNamedParser("TestIni", Default)
|
||||
p.AddGroup("Application Options", "The application options", &opts)
|
||||
|
||||
inip := NewIniParser(p)
|
||||
|
||||
inic := `[Application Options]
|
||||
value = some value
|
||||
|
||||
[add]
|
||||
AliasName = 5
|
||||
|
||||
[add.Other Options]
|
||||
other = subgroup
|
||||
|
||||
`
|
||||
|
||||
b := strings.NewReader(inic)
|
||||
err := inip.Parse(b)
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error: %s", err)
|
||||
}
|
||||
|
||||
assertString(t, opts.Value, "some value")
|
||||
|
||||
if opts.Add.Name != 5 {
|
||||
t.Errorf("Expected opts.Add.Name to be 5, but got %v", opts.Add.Name)
|
||||
}
|
||||
|
||||
assertString(t, opts.Add.Other.O, "subgroup")
|
||||
|
||||
// Test writing it back
|
||||
buf := &bytes.Buffer{}
|
||||
|
||||
inip.Write(buf, IniDefault)
|
||||
|
||||
assertDiff(t, buf.String(), inic, "ini contents")
|
||||
}
|
||||
|
||||
func TestIniNoIni(t *testing.T) {
|
||||
var opts struct {
|
||||
NoValue string `short:"n" long:"novalue" no-ini:"yes"`
|
||||
Value string `short:"v" long:"value"`
|
||||
}
|
||||
|
||||
p := NewNamedParser("TestIni", Default)
|
||||
p.AddGroup("Application Options", "The application options", &opts)
|
||||
|
||||
inip := NewIniParser(p)
|
||||
|
||||
// read INI
|
||||
inic := `[Application Options]
|
||||
novalue = some value
|
||||
value = some other value
|
||||
`
|
||||
|
||||
b := strings.NewReader(inic)
|
||||
err := inip.Parse(b)
|
||||
|
||||
if err == nil {
|
||||
t.Fatalf("Expected error")
|
||||
}
|
||||
|
||||
iniError := err.(*IniError)
|
||||
|
||||
if v := uint(2); iniError.LineNumber != v {
|
||||
t.Errorf("Expected opts.Add.Name to be %d, but got %d", v, iniError.LineNumber)
|
||||
}
|
||||
|
||||
if v := "unknown option: novalue"; iniError.Message != v {
|
||||
t.Errorf("Expected opts.Add.Name to be %s, but got %s", v, iniError.Message)
|
||||
}
|
||||
|
||||
// write INI
|
||||
opts.NoValue = "some value"
|
||||
opts.Value = "some other value"
|
||||
|
||||
file, err := ioutil.TempFile("", "")
|
||||
if err != nil {
|
||||
t.Fatalf("Cannot create temporary file: %s", err)
|
||||
}
|
||||
defer os.Remove(file.Name())
|
||||
|
||||
err = inip.WriteFile(file.Name(), IniIncludeDefaults)
|
||||
if err != nil {
|
||||
t.Fatalf("Could not write ini file: %s", err)
|
||||
}
|
||||
|
||||
found, err := ioutil.ReadFile(file.Name())
|
||||
if err != nil {
|
||||
t.Fatalf("Could not read written ini file: %s", err)
|
||||
}
|
||||
|
||||
expected := "[Application Options]\nValue = some other value\n\n"
|
||||
|
||||
assertDiff(t, string(found), expected, "ini content")
|
||||
}
|
||||
|
||||
func TestIniParse(t *testing.T) {
|
||||
file, err := ioutil.TempFile("", "")
|
||||
if err != nil {
|
||||
t.Fatalf("Cannot create temporary file: %s", err)
|
||||
}
|
||||
defer os.Remove(file.Name())
|
||||
|
||||
_, err = file.WriteString("value = 123")
|
||||
if err != nil {
|
||||
t.Fatalf("Cannot write to temporary file: %s", err)
|
||||
}
|
||||
|
||||
file.Close()
|
||||
|
||||
var opts struct {
|
||||
Value int `long:"value"`
|
||||
}
|
||||
|
||||
err = IniParse(file.Name(), &opts)
|
||||
if err != nil {
|
||||
t.Fatalf("Could not parse ini: %s", err)
|
||||
}
|
||||
|
||||
if opts.Value != 123 {
|
||||
t.Fatalf("Expected Value to be \"123\" but was \"%d\"", opts.Value)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWriteFile(t *testing.T) {
|
||||
file, err := ioutil.TempFile("", "")
|
||||
if err != nil {
|
||||
t.Fatalf("Cannot create temporary file: %s", err)
|
||||
}
|
||||
defer os.Remove(file.Name())
|
||||
|
||||
var opts struct {
|
||||
Value int `long:"value"`
|
||||
}
|
||||
|
||||
opts.Value = 123
|
||||
|
||||
p := NewParser(&opts, Default)
|
||||
ini := NewIniParser(p)
|
||||
|
||||
err = ini.WriteFile(file.Name(), IniIncludeDefaults)
|
||||
if err != nil {
|
||||
t.Fatalf("Could not write ini file: %s", err)
|
||||
}
|
||||
|
||||
found, err := ioutil.ReadFile(file.Name())
|
||||
if err != nil {
|
||||
t.Fatalf("Could not read written ini file: %s", err)
|
||||
}
|
||||
|
||||
expected := "[Application Options]\nValue = 123\n\n"
|
||||
|
||||
assertDiff(t, string(found), expected, "ini content")
|
||||
}
|
||||
|
||||
func TestOverwriteRequiredOptions(t *testing.T) {
|
||||
var tests = []struct {
|
||||
args []string
|
||||
expected []string
|
||||
}{
|
||||
{
|
||||
args: []string{"--value", "from CLI"},
|
||||
expected: []string{
|
||||
"from CLI",
|
||||
"from default",
|
||||
},
|
||||
},
|
||||
{
|
||||
args: []string{"--value", "from CLI", "--default", "from CLI"},
|
||||
expected: []string{
|
||||
"from CLI",
|
||||
"from CLI",
|
||||
},
|
||||
},
|
||||
{
|
||||
args: []string{"--config", "no file name"},
|
||||
expected: []string{
|
||||
"from INI",
|
||||
"from INI",
|
||||
},
|
||||
},
|
||||
{
|
||||
args: []string{"--value", "from CLI before", "--default", "from CLI before", "--config", "no file name"},
|
||||
expected: []string{
|
||||
"from INI",
|
||||
"from INI",
|
||||
},
|
||||
},
|
||||
{
|
||||
args: []string{"--value", "from CLI before", "--default", "from CLI before", "--config", "no file name", "--value", "from CLI after", "--default", "from CLI after"},
|
||||
expected: []string{
|
||||
"from CLI after",
|
||||
"from CLI after",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
var opts struct {
|
||||
Config func(s string) error `long:"config" no-ini:"true"`
|
||||
Value string `long:"value" required:"true"`
|
||||
Default string `long:"default" required:"true" default:"from default"`
|
||||
}
|
||||
|
||||
p := NewParser(&opts, Default)
|
||||
|
||||
opts.Config = func(s string) error {
|
||||
ini := NewIniParser(p)
|
||||
|
||||
return ini.Parse(bytes.NewBufferString("value = from INI\ndefault = from INI"))
|
||||
}
|
||||
|
||||
_, err := p.ParseArgs(test.args)
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error %s with args %+v", err, test.args)
|
||||
}
|
||||
|
||||
if opts.Value != test.expected[0] {
|
||||
t.Fatalf("Expected Value to be \"%s\" but was \"%s\" with args %+v", test.expected[0], opts.Value, test.args)
|
||||
}
|
||||
|
||||
if opts.Default != test.expected[1] {
|
||||
t.Fatalf("Expected Default to be \"%s\" but was \"%s\" with args %+v", test.expected[1], opts.Default, test.args)
|
||||
}
|
||||
}
|
||||
}
|
||||
85
Godeps/_workspace/src/github.com/jessevdk/go-flags/long_test.go
generated
vendored
85
Godeps/_workspace/src/github.com/jessevdk/go-flags/long_test.go
generated
vendored
@@ -1,85 +0,0 @@
|
||||
package flags
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestLong(t *testing.T) {
|
||||
var opts = struct {
|
||||
Value bool `long:"value"`
|
||||
}{}
|
||||
|
||||
ret := assertParseSuccess(t, &opts, "--value")
|
||||
|
||||
assertStringArray(t, ret, []string{})
|
||||
|
||||
if !opts.Value {
|
||||
t.Errorf("Expected Value to be true")
|
||||
}
|
||||
}
|
||||
|
||||
func TestLongArg(t *testing.T) {
|
||||
var opts = struct {
|
||||
Value string `long:"value"`
|
||||
}{}
|
||||
|
||||
ret := assertParseSuccess(t, &opts, "--value", "value")
|
||||
|
||||
assertStringArray(t, ret, []string{})
|
||||
assertString(t, opts.Value, "value")
|
||||
}
|
||||
|
||||
func TestLongArgEqual(t *testing.T) {
|
||||
var opts = struct {
|
||||
Value string `long:"value"`
|
||||
}{}
|
||||
|
||||
ret := assertParseSuccess(t, &opts, "--value=value")
|
||||
|
||||
assertStringArray(t, ret, []string{})
|
||||
assertString(t, opts.Value, "value")
|
||||
}
|
||||
|
||||
func TestLongDefault(t *testing.T) {
|
||||
var opts = struct {
|
||||
Value string `long:"value" default:"value"`
|
||||
}{}
|
||||
|
||||
ret := assertParseSuccess(t, &opts)
|
||||
|
||||
assertStringArray(t, ret, []string{})
|
||||
assertString(t, opts.Value, "value")
|
||||
}
|
||||
|
||||
func TestLongOptional(t *testing.T) {
|
||||
var opts = struct {
|
||||
Value string `long:"value" optional:"yes" optional-value:"value"`
|
||||
}{}
|
||||
|
||||
ret := assertParseSuccess(t, &opts, "--value")
|
||||
|
||||
assertStringArray(t, ret, []string{})
|
||||
assertString(t, opts.Value, "value")
|
||||
}
|
||||
|
||||
func TestLongOptionalArg(t *testing.T) {
|
||||
var opts = struct {
|
||||
Value string `long:"value" optional:"yes" optional-value:"value"`
|
||||
}{}
|
||||
|
||||
ret := assertParseSuccess(t, &opts, "--value", "no")
|
||||
|
||||
assertStringArray(t, ret, []string{"no"})
|
||||
assertString(t, opts.Value, "value")
|
||||
}
|
||||
|
||||
func TestLongOptionalArgEqual(t *testing.T) {
|
||||
var opts = struct {
|
||||
Value string `long:"value" optional:"yes" optional-value:"value"`
|
||||
}{}
|
||||
|
||||
ret := assertParseSuccess(t, &opts, "--value=value", "no")
|
||||
|
||||
assertStringArray(t, ret, []string{"no"})
|
||||
assertString(t, opts.Value, "value")
|
||||
}
|
||||
186
Godeps/_workspace/src/github.com/jessevdk/go-flags/man.go
generated
vendored
186
Godeps/_workspace/src/github.com/jessevdk/go-flags/man.go
generated
vendored
@@ -1,186 +0,0 @@
|
||||
package flags
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
func manQuote(s string) string {
|
||||
return strings.Replace(s, "\\", "\\\\", -1)
|
||||
}
|
||||
|
||||
func formatForMan(wr io.Writer, s string) {
|
||||
for {
|
||||
idx := strings.IndexRune(s, '`')
|
||||
|
||||
if idx < 0 {
|
||||
fmt.Fprintf(wr, "%s", manQuote(s))
|
||||
break
|
||||
}
|
||||
|
||||
fmt.Fprintf(wr, "%s", manQuote(s[:idx]))
|
||||
|
||||
s = s[idx+1:]
|
||||
idx = strings.IndexRune(s, '\'')
|
||||
|
||||
if idx < 0 {
|
||||
fmt.Fprintf(wr, "%s", manQuote(s))
|
||||
break
|
||||
}
|
||||
|
||||
fmt.Fprintf(wr, "\\fB%s\\fP", manQuote(s[:idx]))
|
||||
s = s[idx+1:]
|
||||
}
|
||||
}
|
||||
|
||||
func writeManPageOptions(wr io.Writer, grp *Group) {
|
||||
grp.eachGroup(func(group *Group) {
|
||||
for _, opt := range group.options {
|
||||
if !opt.canCli() {
|
||||
continue
|
||||
}
|
||||
|
||||
fmt.Fprintln(wr, ".TP")
|
||||
fmt.Fprintf(wr, "\\fB")
|
||||
|
||||
if opt.ShortName != 0 {
|
||||
fmt.Fprintf(wr, "\\fB\\-%c\\fR", opt.ShortName)
|
||||
}
|
||||
|
||||
if len(opt.LongName) != 0 {
|
||||
if opt.ShortName != 0 {
|
||||
fmt.Fprintf(wr, ", ")
|
||||
}
|
||||
|
||||
fmt.Fprintf(wr, "\\fB\\-\\-%s\\fR", manQuote(opt.LongNameWithNamespace()))
|
||||
}
|
||||
|
||||
if len(opt.ValueName) != 0 || opt.OptionalArgument {
|
||||
if opt.OptionalArgument {
|
||||
fmt.Fprintf(wr, " [\\fI%s=%s\\fR]", manQuote(opt.ValueName), manQuote(strings.Join(quoteV(opt.OptionalValue), ", ")))
|
||||
} else {
|
||||
fmt.Fprintf(wr, " \\fI%s\\fR", manQuote(opt.ValueName))
|
||||
}
|
||||
}
|
||||
|
||||
if len(opt.Default) != 0 {
|
||||
fmt.Fprintf(wr, " <default: \\fI%s\\fR>", manQuote(strings.Join(quoteV(opt.Default), ", ")))
|
||||
} else if len(opt.EnvDefaultKey) != 0 {
|
||||
if runtime.GOOS == "windows" {
|
||||
fmt.Fprintf(wr, " <default: \\fI%%%s%%\\fR>", manQuote(opt.EnvDefaultKey))
|
||||
} else {
|
||||
fmt.Fprintf(wr, " <default: \\fI$%s\\fR>", manQuote(opt.EnvDefaultKey))
|
||||
}
|
||||
}
|
||||
|
||||
if opt.Required {
|
||||
fmt.Fprintf(wr, " (\\fIrequired\\fR)")
|
||||
}
|
||||
|
||||
fmt.Fprintln(wr, "\\fP")
|
||||
|
||||
if len(opt.Description) != 0 {
|
||||
formatForMan(wr, opt.Description)
|
||||
fmt.Fprintln(wr, "")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func writeManPageSubcommands(wr io.Writer, name string, root *Command) {
|
||||
commands := root.sortedCommands()
|
||||
|
||||
for _, c := range commands {
|
||||
var nn string
|
||||
|
||||
if len(name) != 0 {
|
||||
nn = name + " " + c.Name
|
||||
} else {
|
||||
nn = c.Name
|
||||
}
|
||||
|
||||
writeManPageCommand(wr, nn, root, c)
|
||||
}
|
||||
}
|
||||
|
||||
func writeManPageCommand(wr io.Writer, name string, root *Command, command *Command) {
|
||||
fmt.Fprintf(wr, ".SS %s\n", name)
|
||||
fmt.Fprintln(wr, command.ShortDescription)
|
||||
|
||||
if len(command.LongDescription) > 0 {
|
||||
fmt.Fprintln(wr, "")
|
||||
|
||||
cmdstart := fmt.Sprintf("The %s command", manQuote(command.Name))
|
||||
|
||||
if strings.HasPrefix(command.LongDescription, cmdstart) {
|
||||
fmt.Fprintf(wr, "The \\fI%s\\fP command", manQuote(command.Name))
|
||||
|
||||
formatForMan(wr, command.LongDescription[len(cmdstart):])
|
||||
fmt.Fprintln(wr, "")
|
||||
} else {
|
||||
formatForMan(wr, command.LongDescription)
|
||||
fmt.Fprintln(wr, "")
|
||||
}
|
||||
}
|
||||
|
||||
var usage string
|
||||
if us, ok := command.data.(Usage); ok {
|
||||
usage = us.Usage()
|
||||
} else if command.hasCliOptions() {
|
||||
usage = fmt.Sprintf("[%s-OPTIONS]", command.Name)
|
||||
}
|
||||
|
||||
var pre string
|
||||
if root.hasCliOptions() {
|
||||
pre = fmt.Sprintf("%s [OPTIONS] %s", root.Name, command.Name)
|
||||
} else {
|
||||
pre = fmt.Sprintf("%s %s", root.Name, command.Name)
|
||||
}
|
||||
|
||||
if len(usage) > 0 {
|
||||
fmt.Fprintf(wr, "\n\\fBUsage\\fP: %s %s\n\n", manQuote(pre), manQuote(usage))
|
||||
}
|
||||
|
||||
if len(command.Aliases) > 0 {
|
||||
fmt.Fprintf(wr, "\n\\fBAliases\\fP: %s\n\n", manQuote(strings.Join(command.Aliases, ", ")))
|
||||
}
|
||||
|
||||
writeManPageOptions(wr, command.Group)
|
||||
writeManPageSubcommands(wr, name, command)
|
||||
}
|
||||
|
||||
// WriteManPage writes a basic man page in groff format to the specified
|
||||
// writer.
|
||||
func (p *Parser) WriteManPage(wr io.Writer) {
|
||||
t := time.Now()
|
||||
|
||||
fmt.Fprintf(wr, ".TH %s 1 \"%s\"\n", manQuote(p.Name), t.Format("2 January 2006"))
|
||||
fmt.Fprintln(wr, ".SH NAME")
|
||||
fmt.Fprintf(wr, "%s \\- %s\n", manQuote(p.Name), manQuote(p.ShortDescription))
|
||||
fmt.Fprintln(wr, ".SH SYNOPSIS")
|
||||
|
||||
usage := p.Usage
|
||||
|
||||
if len(usage) == 0 {
|
||||
usage = "[OPTIONS]"
|
||||
}
|
||||
|
||||
fmt.Fprintf(wr, "\\fB%s\\fP %s\n", manQuote(p.Name), manQuote(usage))
|
||||
fmt.Fprintln(wr, ".SH DESCRIPTION")
|
||||
|
||||
formatForMan(wr, p.LongDescription)
|
||||
fmt.Fprintln(wr, "")
|
||||
|
||||
fmt.Fprintln(wr, ".SH OPTIONS")
|
||||
|
||||
writeManPageOptions(wr, p.Command.Group)
|
||||
|
||||
if len(p.commands) > 0 {
|
||||
fmt.Fprintln(wr, ".SH COMMANDS")
|
||||
|
||||
writeManPageSubcommands(wr, "", p.Command)
|
||||
}
|
||||
}
|
||||
97
Godeps/_workspace/src/github.com/jessevdk/go-flags/marshal_test.go
generated
vendored
97
Godeps/_workspace/src/github.com/jessevdk/go-flags/marshal_test.go
generated
vendored
@@ -1,97 +0,0 @@
|
||||
package flags
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
type marshalled bool
|
||||
|
||||
func (m *marshalled) UnmarshalFlag(value string) error {
|
||||
if value == "yes" {
|
||||
*m = true
|
||||
} else if value == "no" {
|
||||
*m = false
|
||||
} else {
|
||||
return fmt.Errorf("`%s' is not a valid value, please specify `yes' or `no'", value)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m marshalled) MarshalFlag() (string, error) {
|
||||
if m {
|
||||
return "yes", nil
|
||||
}
|
||||
|
||||
return "no", nil
|
||||
}
|
||||
|
||||
type marshalledError bool
|
||||
|
||||
func (m marshalledError) MarshalFlag() (string, error) {
|
||||
return "", newErrorf(ErrMarshal, "Failed to marshal")
|
||||
}
|
||||
|
||||
func TestUnmarshal(t *testing.T) {
|
||||
var opts = struct {
|
||||
Value marshalled `short:"v"`
|
||||
}{}
|
||||
|
||||
ret := assertParseSuccess(t, &opts, "-v=yes")
|
||||
|
||||
assertStringArray(t, ret, []string{})
|
||||
|
||||
if !opts.Value {
|
||||
t.Errorf("Expected Value to be true")
|
||||
}
|
||||
}
|
||||
|
||||
func TestUnmarshalDefault(t *testing.T) {
|
||||
var opts = struct {
|
||||
Value marshalled `short:"v" default:"yes"`
|
||||
}{}
|
||||
|
||||
ret := assertParseSuccess(t, &opts)
|
||||
|
||||
assertStringArray(t, ret, []string{})
|
||||
|
||||
if !opts.Value {
|
||||
t.Errorf("Expected Value to be true")
|
||||
}
|
||||
}
|
||||
|
||||
func TestUnmarshalOptional(t *testing.T) {
|
||||
var opts = struct {
|
||||
Value marshalled `short:"v" optional:"yes" optional-value:"yes"`
|
||||
}{}
|
||||
|
||||
ret := assertParseSuccess(t, &opts, "-v")
|
||||
|
||||
assertStringArray(t, ret, []string{})
|
||||
|
||||
if !opts.Value {
|
||||
t.Errorf("Expected Value to be true")
|
||||
}
|
||||
}
|
||||
|
||||
func TestUnmarshalError(t *testing.T) {
|
||||
var opts = struct {
|
||||
Value marshalled `short:"v"`
|
||||
}{}
|
||||
|
||||
assertParseFail(t, ErrMarshal, fmt.Sprintf("invalid argument for flag `%cv' (expected flags.marshalled): `invalid' is not a valid value, please specify `yes' or `no'", defaultShortOptDelimiter), &opts, "-vinvalid")
|
||||
}
|
||||
|
||||
func TestMarshalError(t *testing.T) {
|
||||
var opts = struct {
|
||||
Value marshalledError `short:"v"`
|
||||
}{}
|
||||
|
||||
p := NewParser(&opts, Default)
|
||||
o := p.Command.Groups()[0].Options()[0]
|
||||
|
||||
_, err := convertToString(o.value, o.tag)
|
||||
|
||||
assertError(t, err, ErrMarshal, "Failed to marshal")
|
||||
}
|
||||
140
Godeps/_workspace/src/github.com/jessevdk/go-flags/multitag.go
generated
vendored
140
Godeps/_workspace/src/github.com/jessevdk/go-flags/multitag.go
generated
vendored
@@ -1,140 +0,0 @@
|
||||
package flags
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
)
|
||||
|
||||
type multiTag struct {
|
||||
value string
|
||||
cache map[string][]string
|
||||
}
|
||||
|
||||
func newMultiTag(v string) multiTag {
|
||||
return multiTag{
|
||||
value: v,
|
||||
}
|
||||
}
|
||||
|
||||
func (x *multiTag) scan() (map[string][]string, error) {
|
||||
v := x.value
|
||||
|
||||
ret := make(map[string][]string)
|
||||
|
||||
// This is mostly copied from reflect.StructTag.Get
|
||||
for v != "" {
|
||||
i := 0
|
||||
|
||||
// Skip whitespace
|
||||
for i < len(v) && v[i] == ' ' {
|
||||
i++
|
||||
}
|
||||
|
||||
v = v[i:]
|
||||
|
||||
if v == "" {
|
||||
break
|
||||
}
|
||||
|
||||
// Scan to colon to find key
|
||||
i = 0
|
||||
|
||||
for i < len(v) && v[i] != ' ' && v[i] != ':' && v[i] != '"' {
|
||||
i++
|
||||
}
|
||||
|
||||
if i >= len(v) {
|
||||
return nil, newErrorf(ErrTag, "expected `:' after key name, but got end of tag (in `%v`)", x.value)
|
||||
}
|
||||
|
||||
if v[i] != ':' {
|
||||
return nil, newErrorf(ErrTag, "expected `:' after key name, but got `%v' (in `%v`)", v[i], x.value)
|
||||
}
|
||||
|
||||
if i+1 >= len(v) {
|
||||
return nil, newErrorf(ErrTag, "expected `\"' to start tag value at end of tag (in `%v`)", x.value)
|
||||
}
|
||||
|
||||
if v[i+1] != '"' {
|
||||
return nil, newErrorf(ErrTag, "expected `\"' to start tag value, but got `%v' (in `%v`)", v[i+1], x.value)
|
||||
}
|
||||
|
||||
name := v[:i]
|
||||
v = v[i+1:]
|
||||
|
||||
// Scan quoted string to find value
|
||||
i = 1
|
||||
|
||||
for i < len(v) && v[i] != '"' {
|
||||
if v[i] == '\n' {
|
||||
return nil, newErrorf(ErrTag, "unexpected newline in tag value `%v' (in `%v`)", name, x.value)
|
||||
}
|
||||
|
||||
if v[i] == '\\' {
|
||||
i++
|
||||
}
|
||||
i++
|
||||
}
|
||||
|
||||
if i >= len(v) {
|
||||
return nil, newErrorf(ErrTag, "expected end of tag value `\"' at end of tag (in `%v`)", x.value)
|
||||
}
|
||||
|
||||
val, err := strconv.Unquote(v[:i+1])
|
||||
|
||||
if err != nil {
|
||||
return nil, newErrorf(ErrTag, "Malformed value of tag `%v:%v` => %v (in `%v`)", name, v[:i+1], err, x.value)
|
||||
}
|
||||
|
||||
v = v[i+1:]
|
||||
|
||||
ret[name] = append(ret[name], val)
|
||||
}
|
||||
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func (x *multiTag) Parse() error {
|
||||
vals, err := x.scan()
|
||||
x.cache = vals
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (x *multiTag) cached() map[string][]string {
|
||||
if x.cache == nil {
|
||||
cache, _ := x.scan()
|
||||
|
||||
if cache == nil {
|
||||
cache = make(map[string][]string)
|
||||
}
|
||||
|
||||
x.cache = cache
|
||||
}
|
||||
|
||||
return x.cache
|
||||
}
|
||||
|
||||
func (x *multiTag) Get(key string) string {
|
||||
c := x.cached()
|
||||
|
||||
if v, ok := c[key]; ok {
|
||||
return v[len(v)-1]
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *multiTag) GetMany(key string) []string {
|
||||
c := x.cached()
|
||||
return c[key]
|
||||
}
|
||||
|
||||
func (x *multiTag) Set(key string, value string) {
|
||||
c := x.cached()
|
||||
c[key] = []string{value}
|
||||
}
|
||||
|
||||
func (x *multiTag) SetMany(key string, value []string) {
|
||||
c := x.cached()
|
||||
c[key] = value
|
||||
}
|
||||
162
Godeps/_workspace/src/github.com/jessevdk/go-flags/option.go
generated
vendored
162
Godeps/_workspace/src/github.com/jessevdk/go-flags/option.go
generated
vendored
@@ -1,162 +0,0 @@
|
||||
package flags
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
||||
// Option flag information. Contains a description of the option, short and
|
||||
// long name as well as a default value and whether an argument for this
|
||||
// flag is optional.
|
||||
type Option struct {
|
||||
// The description of the option flag. This description is shown
|
||||
// automatically in the built-in help.
|
||||
Description string
|
||||
|
||||
// The short name of the option (a single character). If not 0, the
|
||||
// option flag can be 'activated' using -<ShortName>. Either ShortName
|
||||
// or LongName needs to be non-empty.
|
||||
ShortName rune
|
||||
|
||||
// The long name of the option. If not "", the option flag can be
|
||||
// activated using --<LongName>. Either ShortName or LongName needs
|
||||
// to be non-empty.
|
||||
LongName string
|
||||
|
||||
// The default value of the option.
|
||||
Default []string
|
||||
|
||||
// The optional environment default value key name.
|
||||
EnvDefaultKey string
|
||||
|
||||
// The optional delimiter string for EnvDefaultKey values.
|
||||
EnvDefaultDelim string
|
||||
|
||||
// If true, specifies that the argument to an option flag is optional.
|
||||
// When no argument to the flag is specified on the command line, the
|
||||
// value of OptionalValue will be set in the field this option represents.
|
||||
// This is only valid for non-boolean options.
|
||||
OptionalArgument bool
|
||||
|
||||
// The optional value of the option. The optional value is used when
|
||||
// the option flag is marked as having an OptionalArgument. This means
|
||||
// that when the flag is specified, but no option argument is given,
|
||||
// the value of the field this option represents will be set to
|
||||
// OptionalValue. This is only valid for non-boolean options.
|
||||
OptionalValue []string
|
||||
|
||||
// If true, the option _must_ be specified on the command line. If the
|
||||
// option is not specified, the parser will generate an ErrRequired type
|
||||
// error.
|
||||
Required bool
|
||||
|
||||
// A name for the value of an option shown in the Help as --flag [ValueName]
|
||||
ValueName string
|
||||
|
||||
// A mask value to show in the help instead of the default value. This
|
||||
// is useful for hiding sensitive information in the help, such as
|
||||
// passwords.
|
||||
DefaultMask string
|
||||
|
||||
// The group which the option belongs to
|
||||
group *Group
|
||||
|
||||
// The struct field which the option represents.
|
||||
field reflect.StructField
|
||||
|
||||
// The struct field value which the option represents.
|
||||
value reflect.Value
|
||||
|
||||
// Determines if the option will be always quoted in the INI output
|
||||
iniQuote bool
|
||||
|
||||
tag multiTag
|
||||
isSet bool
|
||||
}
|
||||
|
||||
// LongNameWithNamespace returns the option's long name with the group namespaces
|
||||
// prepended by walking up the option's group tree. Namespaces and the long name
|
||||
// itself are separated by the parser's namespace delimiter. If the long name is
|
||||
// empty an empty string is returned.
|
||||
func (option *Option) LongNameWithNamespace() string {
|
||||
if len(option.LongName) == 0 {
|
||||
return ""
|
||||
}
|
||||
|
||||
// fetch the namespace delimiter from the parser which is always at the
|
||||
// end of the group hierarchy
|
||||
namespaceDelimiter := ""
|
||||
g := option.group
|
||||
|
||||
for {
|
||||
if p, ok := g.parent.(*Parser); ok {
|
||||
namespaceDelimiter = p.NamespaceDelimiter
|
||||
|
||||
break
|
||||
}
|
||||
|
||||
switch i := g.parent.(type) {
|
||||
case *Command:
|
||||
g = i.Group
|
||||
case *Group:
|
||||
g = i
|
||||
}
|
||||
}
|
||||
|
||||
// concatenate long name with namespace
|
||||
longName := option.LongName
|
||||
g = option.group
|
||||
|
||||
for g != nil {
|
||||
if g.Namespace != "" {
|
||||
longName = g.Namespace + namespaceDelimiter + longName
|
||||
}
|
||||
|
||||
switch i := g.parent.(type) {
|
||||
case *Command:
|
||||
g = i.Group
|
||||
case *Group:
|
||||
g = i
|
||||
case *Parser:
|
||||
g = nil
|
||||
}
|
||||
}
|
||||
|
||||
return longName
|
||||
}
|
||||
|
||||
// String converts an option to a human friendly readable string describing the
|
||||
// option.
|
||||
func (option *Option) String() string {
|
||||
var s string
|
||||
var short string
|
||||
|
||||
if option.ShortName != 0 {
|
||||
data := make([]byte, utf8.RuneLen(option.ShortName))
|
||||
utf8.EncodeRune(data, option.ShortName)
|
||||
short = string(data)
|
||||
|
||||
if len(option.LongName) != 0 {
|
||||
s = fmt.Sprintf("%s%s, %s%s",
|
||||
string(defaultShortOptDelimiter), short,
|
||||
defaultLongOptDelimiter, option.LongNameWithNamespace())
|
||||
} else {
|
||||
s = fmt.Sprintf("%s%s", string(defaultShortOptDelimiter), short)
|
||||
}
|
||||
} else if len(option.LongName) != 0 {
|
||||
s = fmt.Sprintf("%s%s", defaultLongOptDelimiter, option.LongNameWithNamespace())
|
||||
}
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
// Value returns the option value as an interface{}.
|
||||
func (option *Option) Value() interface{} {
|
||||
return option.value.Interface()
|
||||
}
|
||||
|
||||
// IsSet returns true if option has been set
|
||||
func (option *Option) IsSet() bool {
|
||||
return option.isSet
|
||||
}
|
||||
182
Godeps/_workspace/src/github.com/jessevdk/go-flags/option_private.go
generated
vendored
182
Godeps/_workspace/src/github.com/jessevdk/go-flags/option_private.go
generated
vendored
@@ -1,182 +0,0 @@
|
||||
package flags
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"strings"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
// Set the value of an option to the specified value. An error will be returned
|
||||
// if the specified value could not be converted to the corresponding option
|
||||
// value type.
|
||||
func (option *Option) set(value *string) error {
|
||||
option.isSet = true
|
||||
|
||||
if option.isFunc() {
|
||||
return option.call(value)
|
||||
} else if value != nil {
|
||||
return convert(*value, option.value, option.tag)
|
||||
}
|
||||
|
||||
return convert("", option.value, option.tag)
|
||||
}
|
||||
|
||||
func (option *Option) canCli() bool {
|
||||
return option.ShortName != 0 || len(option.LongName) != 0
|
||||
}
|
||||
|
||||
func (option *Option) canArgument() bool {
|
||||
if u := option.isUnmarshaler(); u != nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return !option.isBool()
|
||||
}
|
||||
|
||||
func (option *Option) emptyValue() reflect.Value {
|
||||
tp := option.value.Type()
|
||||
|
||||
if tp.Kind() == reflect.Map {
|
||||
return reflect.MakeMap(tp)
|
||||
}
|
||||
|
||||
return reflect.Zero(tp)
|
||||
}
|
||||
|
||||
func (option *Option) empty() {
|
||||
if !option.isFunc() {
|
||||
option.value.Set(option.emptyValue())
|
||||
}
|
||||
}
|
||||
|
||||
func (option *Option) clearDefault() {
|
||||
usedDefault := option.Default
|
||||
if envKey := option.EnvDefaultKey; envKey != "" {
|
||||
// os.Getenv() makes no distinction between undefined and
|
||||
// empty values, so we use syscall.Getenv()
|
||||
if value, ok := syscall.Getenv(envKey); ok {
|
||||
if option.EnvDefaultDelim != "" {
|
||||
usedDefault = strings.Split(value,
|
||||
option.EnvDefaultDelim)
|
||||
} else {
|
||||
usedDefault = []string{value}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(usedDefault) > 0 {
|
||||
option.empty()
|
||||
|
||||
for _, d := range usedDefault {
|
||||
option.set(&d)
|
||||
}
|
||||
} else {
|
||||
tp := option.value.Type()
|
||||
|
||||
switch tp.Kind() {
|
||||
case reflect.Map:
|
||||
if option.value.IsNil() {
|
||||
option.empty()
|
||||
}
|
||||
case reflect.Slice:
|
||||
if option.value.IsNil() {
|
||||
option.empty()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (option *Option) valueIsDefault() bool {
|
||||
// Check if the value of the option corresponds to its
|
||||
// default value
|
||||
emptyval := option.emptyValue()
|
||||
|
||||
checkvalptr := reflect.New(emptyval.Type())
|
||||
checkval := reflect.Indirect(checkvalptr)
|
||||
|
||||
checkval.Set(emptyval)
|
||||
|
||||
if len(option.Default) != 0 {
|
||||
for _, v := range option.Default {
|
||||
convert(v, checkval, option.tag)
|
||||
}
|
||||
}
|
||||
|
||||
return reflect.DeepEqual(option.value.Interface(), checkval.Interface())
|
||||
}
|
||||
|
||||
func (option *Option) isUnmarshaler() Unmarshaler {
|
||||
v := option.value
|
||||
|
||||
for {
|
||||
if !v.CanInterface() {
|
||||
break
|
||||
}
|
||||
|
||||
i := v.Interface()
|
||||
|
||||
if u, ok := i.(Unmarshaler); ok {
|
||||
return u
|
||||
}
|
||||
|
||||
if !v.CanAddr() {
|
||||
break
|
||||
}
|
||||
|
||||
v = v.Addr()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (option *Option) isBool() bool {
|
||||
tp := option.value.Type()
|
||||
|
||||
for {
|
||||
switch tp.Kind() {
|
||||
case reflect.Bool:
|
||||
return true
|
||||
case reflect.Slice:
|
||||
return (tp.Elem().Kind() == reflect.Bool)
|
||||
case reflect.Func:
|
||||
return tp.NumIn() == 0
|
||||
case reflect.Ptr:
|
||||
tp = tp.Elem()
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (option *Option) isFunc() bool {
|
||||
return option.value.Type().Kind() == reflect.Func
|
||||
}
|
||||
|
||||
func (option *Option) call(value *string) error {
|
||||
var retval []reflect.Value
|
||||
|
||||
if value == nil {
|
||||
retval = option.value.Call(nil)
|
||||
} else {
|
||||
tp := option.value.Type().In(0)
|
||||
|
||||
val := reflect.New(tp)
|
||||
val = reflect.Indirect(val)
|
||||
|
||||
if err := convert(*value, val, option.tag); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
retval = option.value.Call([]reflect.Value{val})
|
||||
}
|
||||
|
||||
if len(retval) == 1 && retval[0].Type() == reflect.TypeOf((*error)(nil)).Elem() {
|
||||
if retval[0].Interface() == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return retval[0].Interface().(error)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
45
Godeps/_workspace/src/github.com/jessevdk/go-flags/options_test.go
generated
vendored
45
Godeps/_workspace/src/github.com/jessevdk/go-flags/options_test.go
generated
vendored
@@ -1,45 +0,0 @@
|
||||
package flags
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestPassDoubleDash(t *testing.T) {
|
||||
var opts = struct {
|
||||
Value bool `short:"v"`
|
||||
}{}
|
||||
|
||||
p := NewParser(&opts, PassDoubleDash)
|
||||
ret, err := p.ParseArgs([]string{"-v", "--", "-v", "-g"})
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
if !opts.Value {
|
||||
t.Errorf("Expected Value to be true")
|
||||
}
|
||||
|
||||
assertStringArray(t, ret, []string{"-v", "-g"})
|
||||
}
|
||||
|
||||
func TestPassAfterNonOption(t *testing.T) {
|
||||
var opts = struct {
|
||||
Value bool `short:"v"`
|
||||
}{}
|
||||
|
||||
p := NewParser(&opts, PassAfterNonOption)
|
||||
ret, err := p.ParseArgs([]string{"-v", "arg", "-v", "-g"})
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
if !opts.Value {
|
||||
t.Errorf("Expected Value to be true")
|
||||
}
|
||||
|
||||
assertStringArray(t, ret, []string{"arg", "-v", "-g"})
|
||||
}
|
||||
67
Godeps/_workspace/src/github.com/jessevdk/go-flags/optstyle_other.go
generated
vendored
67
Godeps/_workspace/src/github.com/jessevdk/go-flags/optstyle_other.go
generated
vendored
@@ -1,67 +0,0 @@
|
||||
// +build !windows
|
||||
|
||||
package flags
|
||||
|
||||
import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
const (
|
||||
defaultShortOptDelimiter = '-'
|
||||
defaultLongOptDelimiter = "--"
|
||||
defaultNameArgDelimiter = '='
|
||||
)
|
||||
|
||||
func argumentStartsOption(arg string) bool {
|
||||
return len(arg) > 0 && arg[0] == '-'
|
||||
}
|
||||
|
||||
func argumentIsOption(arg string) bool {
|
||||
if len(arg) > 1 && arg[0] == '-' && arg[1] != '-' {
|
||||
return true
|
||||
}
|
||||
|
||||
if len(arg) > 2 && arg[0] == '-' && arg[1] == '-' && arg[2] != '-' {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// stripOptionPrefix returns the option without the prefix and whether or
|
||||
// not the option is a long option or not.
|
||||
func stripOptionPrefix(optname string) (prefix string, name string, islong bool) {
|
||||
if strings.HasPrefix(optname, "--") {
|
||||
return "--", optname[2:], true
|
||||
} else if strings.HasPrefix(optname, "-") {
|
||||
return "-", optname[1:], false
|
||||
}
|
||||
|
||||
return "", optname, false
|
||||
}
|
||||
|
||||
// splitOption attempts to split the passed option into a name and an argument.
|
||||
// When there is no argument specified, nil will be returned for it.
|
||||
func splitOption(prefix string, option string, islong bool) (string, string, *string) {
|
||||
pos := strings.Index(option, "=")
|
||||
|
||||
if (islong && pos >= 0) || (!islong && pos == 1) {
|
||||
rest := option[pos+1:]
|
||||
return option[:pos], "=", &rest
|
||||
}
|
||||
|
||||
return option, "", nil
|
||||
}
|
||||
|
||||
// addHelpGroup adds a new group that contains default help parameters.
|
||||
func (c *Command) addHelpGroup(showHelp func() error) *Group {
|
||||
var help struct {
|
||||
ShowHelp func() error `short:"h" long:"help" description:"Show this help message"`
|
||||
}
|
||||
|
||||
help.ShowHelp = showHelp
|
||||
ret, _ := c.AddGroup("Help Options", "", &help)
|
||||
ret.isBuiltinHelp = true
|
||||
|
||||
return ret
|
||||
}
|
||||
106
Godeps/_workspace/src/github.com/jessevdk/go-flags/optstyle_windows.go
generated
vendored
106
Godeps/_workspace/src/github.com/jessevdk/go-flags/optstyle_windows.go
generated
vendored
@@ -1,106 +0,0 @@
|
||||
package flags
|
||||
|
||||
import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Windows uses a front slash for both short and long options. Also it uses
|
||||
// a colon for name/argument delimter.
|
||||
const (
|
||||
defaultShortOptDelimiter = '/'
|
||||
defaultLongOptDelimiter = "/"
|
||||
defaultNameArgDelimiter = ':'
|
||||
)
|
||||
|
||||
func argumentStartsOption(arg string) bool {
|
||||
return len(arg) > 0 && (arg[0] == '-' || arg[0] == '/')
|
||||
}
|
||||
|
||||
func argumentIsOption(arg string) bool {
|
||||
// Windows-style options allow front slash for the option
|
||||
// delimiter.
|
||||
if len(arg) > 1 && arg[0] == '/' {
|
||||
return true
|
||||
}
|
||||
|
||||
if len(arg) > 1 && arg[0] == '-' && arg[1] != '-' {
|
||||
return true
|
||||
}
|
||||
|
||||
if len(arg) > 2 && arg[0] == '-' && arg[1] == '-' && arg[2] != '-' {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// stripOptionPrefix returns the option without the prefix and whether or
|
||||
// not the option is a long option or not.
|
||||
func stripOptionPrefix(optname string) (prefix string, name string, islong bool) {
|
||||
// Determine if the argument is a long option or not. Windows
|
||||
// typically supports both long and short options with a single
|
||||
// front slash as the option delimiter, so handle this situation
|
||||
// nicely.
|
||||
possplit := 0
|
||||
|
||||
if strings.HasPrefix(optname, "--") {
|
||||
possplit = 2
|
||||
islong = true
|
||||
} else if strings.HasPrefix(optname, "-") {
|
||||
possplit = 1
|
||||
islong = false
|
||||
} else if strings.HasPrefix(optname, "/") {
|
||||
possplit = 1
|
||||
islong = len(optname) > 2
|
||||
}
|
||||
|
||||
return optname[:possplit], optname[possplit:], islong
|
||||
}
|
||||
|
||||
// splitOption attempts to split the passed option into a name and an argument.
|
||||
// When there is no argument specified, nil will be returned for it.
|
||||
func splitOption(prefix string, option string, islong bool) (string, string, *string) {
|
||||
if len(option) == 0 {
|
||||
return option, "", nil
|
||||
}
|
||||
|
||||
// Windows typically uses a colon for the option name and argument
|
||||
// delimiter while POSIX typically uses an equals. Support both styles,
|
||||
// but don't allow the two to be mixed. That is to say /foo:bar and
|
||||
// --foo=bar are acceptable, but /foo=bar and --foo:bar are not.
|
||||
var pos int
|
||||
var sp string
|
||||
|
||||
if prefix == "/" {
|
||||
sp = ":"
|
||||
pos = strings.Index(option, sp)
|
||||
} else if len(prefix) > 0 {
|
||||
sp = "="
|
||||
pos = strings.Index(option, sp)
|
||||
}
|
||||
|
||||
if (islong && pos >= 0) || (!islong && pos == 1) {
|
||||
rest := option[pos+1:]
|
||||
return option[:pos], sp, &rest
|
||||
}
|
||||
|
||||
return option, "", nil
|
||||
}
|
||||
|
||||
// addHelpGroup adds a new group that contains default help parameters.
|
||||
func (c *Command) addHelpGroup(showHelp func() error) *Group {
|
||||
// Windows CLI applications typically use /? for help, so make both
|
||||
// that available as well as the POSIX style h and help.
|
||||
var help struct {
|
||||
ShowHelpWindows func() error `short:"?" description:"Show this help message"`
|
||||
ShowHelpPosix func() error `short:"h" long:"help" description:"Show this help message"`
|
||||
}
|
||||
|
||||
help.ShowHelpWindows = showHelp
|
||||
help.ShowHelpPosix = showHelp
|
||||
|
||||
ret, _ := c.AddGroup("Help Options", "", &help)
|
||||
ret.isBuiltinHelp = true
|
||||
|
||||
return ret
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user