mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Compare commits
1225 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
e86b77131a | ||
|
91942b68f2 | ||
|
65aa2c9877 | ||
|
971fcee8db | ||
|
46389463f3 | ||
|
a85e61f5f9 | ||
|
dadbb8c8f4 | ||
|
8eb4a25891 | ||
|
2fd9d623a1 | ||
|
3592ba45ca | ||
|
0b4b503086 | ||
|
9fb57845ed | ||
|
ac0aafc04d | ||
|
4d2027d983 | ||
|
a22c197d9b | ||
|
2ec2fc37a5 | ||
|
f71a326fe2 | ||
|
f844ff3afb | ||
|
582557e408 | ||
|
9446886b37 | ||
|
0035e479c8 | ||
|
6f0605d145 | ||
|
0a89786826 | ||
|
02db55a136 | ||
|
15769f21d0 | ||
|
cf3229e0cd | ||
|
7c12523139 | ||
|
369a59e25d | ||
|
a8b0fa897a | ||
|
6ecec4f149 | ||
|
f48b17269c | ||
|
6fcd74bb82 | ||
|
ddfc439c41 | ||
|
7c3d476def | ||
|
49109c77f7 | ||
|
a5f66588e7 | ||
|
2341446376 | ||
|
9a703dd78b | ||
|
767a18ad86 | ||
|
f55024b352 | ||
|
4b8b735a46 | ||
|
8068ffeb7d | ||
|
5783473cfa | ||
|
d341c21f4b | ||
|
b434e79b9b | ||
|
2f2df04478 | ||
|
d7da659b8b | ||
|
fd794707cd | ||
|
9ba22f656b | ||
|
c41411b97e | ||
|
56469d8db3 | ||
|
4cde3c7781 | ||
|
2246300740 | ||
|
190b06182f | ||
|
b2168be56e | ||
|
cf808dd09b | ||
|
90d672b2f2 | ||
|
68906edf49 | ||
|
14729b2bfd | ||
|
20a8c1aa9c | ||
|
e195453573 | ||
|
d6a0797bf2 | ||
|
f9a06540f1 | ||
|
4a820dd0e5 | ||
|
2430fe9f56 | ||
|
3521ebf6e8 | ||
|
a18f77bfad | ||
|
7e0f10223c | ||
|
727b6f5a58 | ||
|
aae1cf55cc | ||
|
acfafb0607 | ||
|
9abd6a60fa | ||
|
234e36bd7e | ||
|
1d38174162 | ||
|
7fbf21d700 | ||
|
ab2df7e10c | ||
|
d530f72075 | ||
|
f58e244cf6 | ||
|
bd01083ad6 | ||
|
7bb6aead0e | ||
|
52b5ac4f0c | ||
|
546f73d56c | ||
|
03b6ad6f08 | ||
|
47da77a382 | ||
|
1dbc28618d | ||
|
0f0b28bdf6 | ||
|
57a965b0d6 | ||
|
f6eac2d7bc | ||
|
944db701e4 | ||
|
f31168c4fd | ||
|
fd8298dfd1 | ||
|
a728d448cb | ||
|
441e82a3bd | ||
|
64fa5acccb | ||
|
d152a8beee | ||
|
5c6833a0df | ||
|
1ff75dd4cf | ||
|
4d3e9506e4 | ||
|
63462ac8ef | ||
|
cff8e7fae7 | ||
|
c10e67d4b5 | ||
|
e5f52587da | ||
|
35e5344e5c | ||
|
a746ab6975 | ||
|
63aa353db3 | ||
|
f84142553c | ||
|
b18c838a69 | ||
|
b2e0c520e8 | ||
|
b333a1499a | ||
|
0ab72ab7bb | ||
|
ebea03edcf | ||
|
35499987ce | ||
|
1afaa2ba45 | ||
|
9fc8eccba9 | ||
|
1b261acb5c | ||
|
dc6d9d4e12 | ||
|
21bdf18e98 | ||
|
b8c9f96db2 | ||
|
dd4899a07c | ||
|
6908e744e1 | ||
|
7f05fbcda5 | ||
|
33bb990583 | ||
|
9f94e8c63a | ||
|
84763f3947 | ||
|
36c4a7f428 | ||
|
65a9894bba | ||
|
98f3e33f8d | ||
|
0e4f5e8bf8 | ||
|
b527d9c4da | ||
|
f2fa715bb5 | ||
|
3ea1d4542a | ||
|
6593827a99 | ||
|
470a1deb22 | ||
|
9a2bd261c0 | ||
|
4205327b95 | ||
|
b1022d6d18 | ||
|
3c53af8c24 | ||
|
4064d42fed | ||
|
cb29f8126c | ||
|
7ce124aaab | ||
|
a7334b0c58 | ||
|
05b9d8adca | ||
|
b96d319b26 | ||
|
89edac3e8f | ||
|
8d517eeb5e | ||
|
589af9917a | ||
|
a43b302452 | ||
|
534514f558 | ||
|
2990ff4ac0 | ||
|
7643109c63 | ||
|
2f70693656 | ||
|
e23cec2897 | ||
|
34154620f6 | ||
|
57bf5c7417 | ||
|
c6567d15af | ||
|
450483791f | ||
|
3c63eee8d3 | ||
|
38e21605a4 | ||
|
87ce0d887e | ||
|
f7d99c5eff | ||
|
0f07cb6980 | ||
|
264b9875ea | ||
|
4192a02594 | ||
|
798d812f80 | ||
|
1712034a14 | ||
|
15b91b2d28 | ||
|
b8168ce7f2 | ||
|
f1b31f6f49 | ||
|
293ee105f7 | ||
|
a6da089bec | ||
|
2537a7f49a | ||
|
fcc2a211df | ||
|
f2517b3e64 | ||
|
cab3f9c658 | ||
|
6cc00f54d3 | ||
|
04f62d3de8 | ||
|
c9d65fd7e7 | ||
|
aa8ed14a1b | ||
|
2b10f8de88 | ||
|
c1f7e3acc9 | ||
|
0f36063696 | ||
|
9a366ffeb9 | ||
|
772bea0152 | ||
|
edf0aa5c14 | ||
|
d46546a86b | ||
|
bdf642b773 | ||
|
184b3744c2 | ||
|
c4ca3d9b2a | ||
|
c8562c533b | ||
|
e56b8693a2 | ||
|
5e44a01699 | ||
|
787d27b498 | ||
|
71a308b87f | ||
|
4a14acd89c | ||
|
e38ade946a | ||
|
585f6cc64c | ||
|
10ff19ff24 | ||
|
904df45548 | ||
|
6a5f4ba54d | ||
|
dae9135e1d | ||
|
caa721d6e1 | ||
|
48dda57473 | ||
|
30b0d8a981 | ||
|
9fb90c02f0 | ||
|
1a596fa635 | ||
|
d672f57c14 | ||
|
cae3ae7c4b | ||
|
17dc53256a | ||
|
9c9446fc0d | ||
|
de91ff797e | ||
|
5a2c5e2c59 | ||
|
432f4d2a44 | ||
|
95e048e40d | ||
|
8af1a077ae | ||
|
ed26de79cc | ||
|
027439fa3b | ||
|
0a1744d80a | ||
|
7aa9106320 | ||
|
2ca1be271e | ||
|
9b0f4a50e8 | ||
|
5d0781f2d8 | ||
|
510c5d576c | ||
|
fa5b35b27b | ||
|
fd91a48f58 | ||
|
077b4d078f | ||
|
a0e34507db | ||
|
e33ce62d8e | ||
|
e15a7b23f2 | ||
|
2054d7c801 | ||
|
df7499940c | ||
|
0f5b038c7f | ||
|
83bdb2bcf8 | ||
|
f051bdb239 | ||
|
e581646d31 | ||
|
391ce432a7 | ||
|
24ba1ee07c | ||
|
ae097d2e5c | ||
|
71d9e1b098 | ||
|
e9883ad60d | ||
|
d493c4d16f | ||
|
eef204c77e | ||
|
17d5ff95cd | ||
|
36acf84a04 | ||
|
5a9bdd4a7f | ||
|
1b04f753c6 | ||
|
716227c19a | ||
|
1e4f200219 | ||
|
a434668ff8 | ||
|
6714bc0903 | ||
|
135e978f87 | ||
|
1aeba34310 | ||
|
48468f8d4d | ||
|
89064ffe7c | ||
|
e9071488d4 | ||
|
90c3f0f0f2 | ||
|
c64277e225 | ||
|
484cb88ef8 | ||
|
cae65df68f | ||
|
9603cc2d1d | ||
|
bacdc82ede | ||
|
f104859679 | ||
|
2cf29e419d | ||
|
3fd813cd9c | ||
|
12892cbc61 | ||
|
056707d7c2 | ||
|
15df0ee2f4 | ||
|
898fc6d34a | ||
|
426414eb1f | ||
|
3dbfc14056 | ||
|
0b63a56e40 | ||
|
afc9e2d2af | ||
|
d38e2c4478 | ||
|
715ec4f952 | ||
|
4a3a3d10ac | ||
|
21889eeb23 | ||
|
2f96fcd0a8 | ||
|
767004f1eb | ||
|
4432fc1537 | ||
|
02ef02538d | ||
|
d3834271e0 | ||
|
aa5e5e70a9 | ||
|
068f0e46fd | ||
|
eed194ea83 | ||
|
0eb6fcc47c | ||
|
6c71564d3e | ||
|
35505394d1 | ||
|
988a9deee5 | ||
|
204e286caa | ||
|
f45c231f48 | ||
|
74154dcdf9 | ||
|
a68c20926b | ||
|
92285b194f | ||
|
dee6629860 | ||
|
e2b958988c | ||
|
a0a85a5383 | ||
|
e36d6ba78c | ||
|
cde24ef8f3 | ||
|
b6f2d1423e | ||
|
a1a11dffff | ||
|
6e79c55583 | ||
|
4a9dd411dd | ||
|
0911402926 | ||
|
86c7e127aa | ||
|
003951c422 | ||
|
c80c2fb657 | ||
|
5694b6d453 | ||
|
234943d9fd | ||
|
fdd10ce643 | ||
|
322dcf618c | ||
|
e554e5b297 | ||
|
0715af78fe | ||
|
75eb58d7c7 | ||
|
0e3295beec | ||
|
bc89be84b0 | ||
|
dc05338ae7 | ||
|
a5d55eb224 | ||
|
b6a666fe59 | ||
|
6981b53336 | ||
|
4a7bdeab3c | ||
|
4bb725db9e | ||
|
e43c37cc07 | ||
|
cda15e841b | ||
|
8212fec6e6 | ||
|
3a2b1c988a | ||
|
b49987f935 | ||
|
a732132498 | ||
|
12325ee39e | ||
|
3c405da087 | ||
|
d247ec0197 | ||
|
13b421b08e | ||
|
f0ca3b8a58 | ||
|
0384258032 | ||
|
222687cebe | ||
|
0c0838b345 | ||
|
9cd9a58759 | ||
|
a19c9c3e33 | ||
|
e035f3a15a | ||
|
ad650d3822 | ||
|
b552bec903 | ||
|
c6f6036f5a | ||
|
5e7e8667a7 | ||
|
f99e333039 | ||
|
31b0f1131e | ||
|
45dad9779e | ||
|
d712769511 | ||
|
880168989c | ||
|
97fa1e51bd | ||
|
0b3a326fe3 | ||
|
93f8172029 | ||
|
dbab6be1d4 | ||
|
cc8f5f76ba | ||
|
5a99bbf30b | ||
|
394da85e62 | ||
|
8613add2df | ||
|
daf1e61335 | ||
|
894afaa66f | ||
|
4dda2e4160 | ||
|
af4f4ed83f | ||
|
216124437a | ||
|
ad2ad7437e | ||
|
f895591e8e | ||
|
4e057db343 | ||
|
72ae0ccd8b | ||
|
cb0b2f19cf | ||
|
409cafc402 | ||
|
04ade97cbc | ||
|
2adb7db4b3 | ||
|
a2ec97d2d9 | ||
|
531e29396f | ||
|
70b626ffe8 | ||
|
53ed90dab5 | ||
|
a7d615b5ba | ||
|
15d760dd10 | ||
|
db55ad59de | ||
|
3393454e0a | ||
|
fd57ff0724 | ||
|
72619a99a4 | ||
|
62e3523d29 | ||
|
e453408457 | ||
|
eab42ade1d | ||
|
80edeef484 | ||
|
e396cf1533 | ||
|
38ec02f62d | ||
|
b1cdb67c2d | ||
|
36f0b6e4b5 | ||
|
60810aff60 | ||
|
507cba20bc | ||
|
bf861da0e3 | ||
|
c1abf82b3c | ||
|
9bba9b33fc | ||
|
740e107aab | ||
|
62f4a17459 | ||
|
42a1720620 | ||
|
3007571704 | ||
|
28059c9f66 | ||
|
14602299a1 | ||
|
fcf78b7d14 | ||
|
538971c28e | ||
|
a6d1aafdf8 | ||
|
47b5abe06c | ||
|
7cfc5e0c66 | ||
|
14fca518ac | ||
|
0ae44a4d5c | ||
|
55c383f11c | ||
|
bc1142d7be | ||
|
46d51eebf9 | ||
|
629661df05 | ||
|
8dde85989d | ||
|
e32565d3b2 | ||
|
a1eaccb397 | ||
|
e98a65c3da | ||
|
f9c11bf16f | ||
|
3554684ffb | ||
|
dfe55583d8 | ||
|
11fdb2472e | ||
|
6c1828234a | ||
|
2c6e546e1a | ||
|
25bcd15793 | ||
|
e05c21e86f | ||
|
7ab898c718 | ||
|
eed4cafdfa | ||
|
f5df6b826e | ||
|
087aabcfe7 | ||
|
115595383d | ||
|
ad49c70e5b | ||
|
4bc4a4342f | ||
|
f2692b0fb7 | ||
|
579b14a4e0 | ||
|
0b3e22e9b9 | ||
|
45f156598e | ||
|
b1fba82bed | ||
|
d7cacefb8d | ||
|
2b1ad14adf | ||
|
f32488263e | ||
|
cb90d95965 | ||
|
7fc1ae4e4b | ||
|
ac39734f6d | ||
|
558a8a0aa4 | ||
|
6ce81d2065 | ||
|
28fb6d9920 | ||
|
9a75ac6214 | ||
|
9551428908 | ||
|
5fac24d73b | ||
|
2f5963596e | ||
|
da1654baa7 | ||
|
bd004d6844 | ||
|
1acaeb6ef8 | ||
|
b178c913d2 | ||
|
e46d9eb02c | ||
|
ca241b5d6f | ||
|
d91a7f88c9 | ||
|
5224a46ee7 | ||
|
965481f589 | ||
|
b0d706199f | ||
|
fc4e68a150 | ||
|
a21d8a06f5 | ||
|
7ce90d92df | ||
|
bca635087c | ||
|
e96dac34e3 | ||
|
d0f00890e1 | ||
|
752cda88e3 | ||
|
571526b993 | ||
|
b8710d6c45 | ||
|
8221cb9173 | ||
|
beccd014f6 | ||
|
b344b36b68 | ||
|
6747784acd | ||
|
4eeb6d67a9 | ||
|
a876c1257d | ||
|
ce0151becc | ||
|
c1f9c910e1 | ||
|
cc169f1674 | ||
|
5f1aeec5ae | ||
|
3e7d5157b2 | ||
|
e679a981da | ||
|
86b32b3f9f | ||
|
fa0d8761ae | ||
|
ac2817613b | ||
|
e1d4e60216 | ||
|
a7facc85fa | ||
|
091b2b975f | ||
|
2020c9683a | ||
|
4cbbedc42e | ||
|
c149ef699f | ||
|
7b56b70368 | ||
|
d88b3ebaac | ||
|
10f761dbcb | ||
|
cde904ff08 | ||
|
04ff03ab1c | ||
|
35a8b0e1b5 | ||
|
21255cc875 | ||
|
e9f2500637 | ||
|
140dd553e0 | ||
|
3a388fba23 | ||
|
af64882306 | ||
|
e71038ccf2 | ||
|
37efebf122 | ||
|
b7f8ec5ae2 | ||
|
53e795384b | ||
|
3d4059de02 | ||
|
703619bf0a | ||
|
1686c9a6a9 | ||
|
ed1e6b2508 | ||
|
746ead5747 | ||
|
5a6424839d | ||
|
b8c87c7dd8 | ||
|
21d0c8491f | ||
|
1a0b0e6886 | ||
|
a8034fb33e | ||
|
5291a31afd | ||
|
58299c2efa | ||
|
e1f1d0a410 | ||
|
ac18990a8c | ||
|
f3ac07cd73 | ||
|
f1ed15a8e4 | ||
|
5f23a0c11f | ||
|
ff2f07812d | ||
|
05b20ba4b7 | ||
|
64f055d708 | ||
|
1981dbf383 | ||
|
4ec9d33a6f | ||
|
9f6a72d674 | ||
|
c259e80721 | ||
|
9bea20442f | ||
|
98de21374a | ||
|
d1ed36a547 | ||
|
8b9b326a59 | ||
|
297978b104 | ||
|
3d513e9c00 | ||
|
31926fd4a7 | ||
|
d9464c4a22 | ||
|
e19409d278 | ||
|
325551c227 | ||
|
07bcb79a22 | ||
|
251e34af22 | ||
|
31ae08d4ca | ||
|
06ffc6cd3d | ||
|
c8b62d8b3e | ||
|
3a6bbee6d4 | ||
|
48882ef759 | ||
|
758296f973 | ||
|
a51dd30e7a | ||
|
4d5722b5e9 | ||
|
99a0d7f0ae | ||
|
80698d5d23 | ||
|
558dfd92c6 | ||
|
4b83183d02 | ||
|
d968c03c7a | ||
|
b86467155e | ||
|
307d8aead0 | ||
|
c8a14e7685 | ||
|
f81c0adb0f | ||
|
53ee5b7d8a | ||
|
fdf6e000cb | ||
|
7e6e8b2042 | ||
|
b9cf3dc5a2 | ||
|
435bc59a01 | ||
|
b3fc9e39db | ||
|
d62356f930 | ||
|
4d20fa1195 | ||
|
428ff80f1d | ||
|
a0b45fe891 | ||
|
b53f69b472 | ||
|
f09923b5b8 | ||
|
20792c13f0 | ||
|
14c2e0c627 | ||
|
c6a10295c1 | ||
|
bf85d4b144 | ||
|
244a86cb7e | ||
|
1fda7492e4 | ||
|
996de81ecd | ||
|
c97e4e1078 | ||
|
f873baea7f | ||
|
a6468c585b | ||
|
29d3a16491 | ||
|
251e3fe10d | ||
|
b2093314f0 | ||
|
5bbbda22aa | ||
|
a18fce88ac | ||
|
7c22408636 | ||
|
e8bc58043f | ||
|
867576c249 | ||
|
d81891f6cc | ||
|
777bcd08b6 | ||
|
c16560decd | ||
|
5bed417faa | ||
|
e081222531 | ||
|
200dbcc03c | ||
|
11b174288b | ||
|
1bfca29d17 | ||
|
837dc92cfc | ||
|
83b98e4a03 | ||
|
b36cb5cf5e | ||
|
0d11940004 | ||
|
ada434b3c3 | ||
|
a99af9a091 | ||
|
41c301fd7c | ||
|
516a8b3da7 | ||
|
263d3ec994 | ||
|
59501353e7 | ||
|
90321636c3 | ||
|
663de7d37f | ||
|
7030eecbdd | ||
|
900d0d0ea5 | ||
|
5261325771 | ||
|
c230853364 | ||
|
47941026f2 | ||
|
22b40ff0ec | ||
|
6a3a5ea7ec | ||
|
e7e1463181 | ||
|
f3839d6cca | ||
|
a8fae544c4 | ||
|
581a28f6ec | ||
|
dd4438d4a9 | ||
|
3c21afef6d | ||
|
54c0739674 | ||
|
d82eda1933 | ||
|
20e30fdefc | ||
|
b934096832 | ||
|
3c95d8e39d | ||
|
0be63a404c | ||
|
4c9990bafd | ||
|
d7b0669796 | ||
|
97bf42045b | ||
|
7f89620225 | ||
|
d5478af03a | ||
|
be3ad2d769 | ||
|
8c328f01e7 | ||
|
e9cd22f082 | ||
|
a64e026b4b | ||
|
a8d11390fe | ||
|
cb636881c3 | ||
|
f6871385f5 | ||
|
db9f3c7b99 | ||
|
0fd763805a | ||
|
80539def51 | ||
|
d399073695 | ||
|
e7a42e05b5 | ||
|
f1303bcc2f | ||
|
fa1bdade76 | ||
|
9a1b350f4e | ||
|
9e71c782e1 | ||
|
40657d78a2 | ||
|
b90ae573c3 | ||
|
946e79509d | ||
|
26cd4f775f | ||
|
1dab3746b6 | ||
|
b0a114da8a | ||
|
c2ba8d40d3 | ||
|
031ecf0a76 | ||
|
6f632292cb | ||
|
2918e49346 | ||
|
e43430e7ad | ||
|
9a8771d66a | ||
|
90287c657d | ||
|
8008e108e6 | ||
|
2fa69d1895 | ||
|
b97cb8dd05 | ||
|
8937fa2f45 | ||
|
149228dd1c | ||
|
ed9ef3268e | ||
|
91cbe0c2df | ||
|
226796099c | ||
|
6b67baa65f | ||
|
419d43670c | ||
|
68e56eaa10 | ||
|
f5e0aec6b6 | ||
|
9e53aed174 | ||
|
270daf31ea | ||
|
d3b6bc503a | ||
|
cdf37f053c | ||
|
5b4a49d11f | ||
|
ca18a14d43 | ||
|
25234e03da | ||
|
e98b15ca2c | ||
|
189c667928 | ||
|
6266ed883a | ||
|
c6c56a1a83 | ||
|
1b608759ec | ||
|
4b8ae6cce9 | ||
|
c9eff660f6 | ||
|
b99a451e1d | ||
|
9e1b660e61 | ||
|
2afbf682e4 | ||
|
5937dcc645 | ||
|
3e84dc2b6e | ||
|
d87a597e3f | ||
|
b352cc3df7 | ||
|
c13c21b340 | ||
|
016bef7f79 | ||
|
260ad3e968 | ||
|
a1526b97e8 | ||
|
cf3cda3b13 | ||
|
02a39915dd | ||
|
cd893736ee | ||
|
1fa73fc3ba | ||
|
fc95a6c1a0 | ||
|
895b33ccdd | ||
|
4e529b49e6 | ||
|
4ef6eb76c6 | ||
|
6b2a53e7a7 | ||
|
a340aa6fa0 | ||
|
abfdad01fe | ||
|
f91e2c3fb0 | ||
|
0629e28105 | ||
|
45b9555633 | ||
|
61bfd97939 | ||
|
c5b36d8f6d | ||
|
0bc29fee35 | ||
|
9a21a2c314 | ||
|
0306ecd746 | ||
|
aca0ff6a74 | ||
|
a2fc558e93 | ||
|
99e3f1008d | ||
|
35742da1da | ||
|
0be50f33ac | ||
|
0a019f60d7 | ||
|
07ed1ea60e | ||
|
00ce724e53 | ||
|
90575dddd2 | ||
|
1a13bc2420 | ||
|
c6d929c674 | ||
|
658718d166 | ||
|
6015698171 | ||
|
f56cc483b4 | ||
|
e16e63f46a | ||
|
15d2e2edb1 | ||
|
df035ee313 | ||
|
7f5d09c508 | ||
|
cee6bd94bd | ||
|
47651fb102 | ||
|
5af3ad471f | ||
|
3c01065bd6 | ||
|
54bffb6291 | ||
|
4837413fbc | ||
|
8434b4c892 | ||
|
acf6785bba | ||
|
110afdad01 | ||
|
7823d1d2e8 | ||
|
410dca728c | ||
|
336e11959d | ||
|
2c1e7fc2c9 | ||
|
b7bd6e3817 | ||
|
617a702441 | ||
|
4aa0f4e43b | ||
|
ef71ad2ced | ||
|
ca0345a0b4 | ||
|
8290988213 | ||
|
596825ec1e | ||
|
aeba4fad4b | ||
|
bacb661573 | ||
|
7c2d6b4c42 | ||
|
fae38e8e64 | ||
|
711908971c | ||
|
c08c937efe | ||
|
301eddafd4 | ||
|
b29e06076b | ||
|
e289c3194a | ||
|
36607f43ad | ||
|
f934f21638 | ||
|
7b9dbdc943 | ||
|
92139d1ba7 | ||
|
11a8f396b7 | ||
|
02bdb405fa | ||
|
b0d6790abe | ||
|
555a1c6def | ||
|
f5e8011906 | ||
|
c366fbb017 | ||
|
8d84f9b7f0 | ||
|
3b30fd6abe | ||
|
6a3708383f | ||
|
771026cc7d | ||
|
be6eb016af | ||
|
7ef9fa0ffe | ||
|
71db72d205 | ||
|
35ee67faa5 | ||
|
90dd200dc8 | ||
|
e720bc7812 | ||
|
1b8ba1ac7b | ||
|
f1533ad391 | ||
|
96132632e9 | ||
|
42137fef2e | ||
|
d913936970 | ||
|
c8f294129c | ||
|
f4ab8cd5e2 | ||
|
9de738362a | ||
|
9b89215e50 | ||
|
c25a3a7d59 | ||
|
b914e3879b | ||
|
08a81914ed | ||
|
00f56a5f3a | ||
|
bf877f5fa7 | ||
|
d6208b4730 | ||
|
248fddf3f4 | ||
|
98afcb7a9e | ||
|
85e31e17f6 | ||
|
e13e82a2b4 | ||
|
bb10669b09 | ||
|
2f9025ae2d | ||
|
93ef3ea429 | ||
|
1bfd26a55c | ||
|
425a08522e | ||
|
330035b107 | ||
|
a13a284fb4 | ||
|
64985c3beb | ||
|
f61f66841b | ||
|
6fea40dc9b | ||
|
9e2bc00b15 | ||
|
1ce29f4930 | ||
|
37ef3e0f62 | ||
|
86bb78d16b | ||
|
d76db44b72 | ||
|
979c7294eb | ||
|
d735047e09 | ||
|
7d0aae1465 | ||
|
78166d3cda | ||
|
00acaa2165 | ||
|
e28bdac0ee | ||
|
e9c6f904b2 | ||
|
f737c53864 | ||
|
1ee3e6d213 | ||
|
9fccd721e0 | ||
|
4c3abf5aca | ||
|
78057fc8df | ||
|
9f81207037 | ||
|
56975bc80a | ||
|
e9014ecb19 | ||
|
8d3763d0a6 | ||
|
8cf50fe92c | ||
|
bb59d527eb | ||
|
5e1abc1ad9 | ||
|
b1aba81cd1 | ||
|
842a24ed1e | ||
|
c83618143e | ||
|
18859ed41e | ||
|
cfc7a8c092 | ||
|
35b7c97791 | ||
|
79bc78a5f7 | ||
|
33ea383046 | ||
|
26ca1618ab | ||
|
bb3c24df73 | ||
|
9b23da07ba | ||
|
e059eeb625 | ||
|
04616ddff5 | ||
|
a620d4fc4c | ||
|
8ca807ee57 | ||
|
7756df16bb | ||
|
3ad04c4969 | ||
|
ba7645a732 | ||
|
8ababedab1 | ||
|
89020c7581 | ||
|
348b2ffa5d | ||
|
6de3f0f5b9 | ||
|
074bd6a803 | ||
|
a6466449b1 | ||
|
4ff64532b2 | ||
|
7dd4e4909b | ||
|
36fbad54d8 | ||
|
32884e5de4 | ||
|
0cd9605a5e | ||
|
78db4fec85 | ||
|
e441e7ebf1 | ||
|
f83e57c0b7 | ||
|
6662c7f18e | ||
|
921d5d1753 | ||
|
9f7ff56f46 | ||
|
001fde13df | ||
|
3fd1651726 | ||
|
ef20be2eee | ||
|
27ecabfb18 | ||
|
5a0b9dfb88 | ||
|
7d99c12220 | ||
|
7056a4489a | ||
|
7fed7577ea | ||
|
66ae65cea4 | ||
|
2c673ae616 | ||
|
d4e0b0956f | ||
|
596bfbac02 | ||
|
e8881ef715 | ||
|
886d9d931f | ||
|
bbf5b12057 | ||
|
993853a8bc | ||
|
faa2098912 | ||
|
37c614245f | ||
|
e213e6b337 | ||
|
bc0d79df7b | ||
|
aef3286769 | ||
|
a781c20088 | ||
|
3d25caabca | ||
|
237a05d056 | ||
|
1c1ce4893a | ||
|
3758ade094 | ||
|
5979564483 | ||
|
e8f38ffda6 | ||
|
23bd900204 | ||
|
0c8c1989b7 | ||
|
12a006f5a8 | ||
|
b184c8ae9f | ||
|
34d6d03b43 | ||
|
bd2f73aea5 | ||
|
c21b7c32a8 | ||
|
87f029a1a3 | ||
|
85fc8f28a1 | ||
|
3faefc1051 | ||
|
3a3394e240 | ||
|
42843b1798 | ||
|
e1e620a573 | ||
|
8bd0bf722c | ||
|
b783e6bf78 | ||
|
e56731a404 | ||
|
2bd7c43006 | ||
|
b4a65a3e4d | ||
|
ecdeac7d90 | ||
|
b7639f5460 | ||
|
ac63b5bb8a | ||
|
b471d585ed | ||
|
d0095f9e62 | ||
|
03733084e6 | ||
|
8835f532cc | ||
|
ff77a3deb0 | ||
|
01d82e3745 | ||
|
42f6a4e171 | ||
|
fcda904e1b | ||
|
fd95a0f2a6 | ||
|
0206fd6baf | ||
|
2d739959f9 | ||
|
2886e58b0d | ||
|
46a4c82e1a | ||
|
471687543c | ||
|
2fce7a129a | ||
|
f1c2a4248f | ||
|
1365b6023b | ||
|
f2c10902b3 | ||
|
0f9e07259e | ||
|
35797d2db6 | ||
|
cbae7449b0 | ||
|
b98ce54750 | ||
|
74d2fbe833 | ||
|
5740b689be | ||
|
925930f76f | ||
|
10f020405f | ||
|
70c5e02ca9 | ||
|
d212037ff5 | ||
|
d0308142a3 | ||
|
ccaca4f1c0 | ||
|
55937c4c40 | ||
|
56067aef86 | ||
|
c3115237a4 | ||
|
a56c1fa923 | ||
|
d5e06fe0c2 | ||
|
5545e4f220 | ||
|
869269c4e8 | ||
|
c3a54de181 | ||
|
68a7553648 | ||
|
02b0be0b22 | ||
|
52aba305b4 | ||
|
9d4609e0c2 | ||
|
db5d50c9af | ||
|
e1da955893 | ||
|
68b64a3ae7 | ||
|
022de7804b | ||
|
2612194f46 | ||
|
68eb640f1e | ||
|
a8bde9ecbe | ||
|
d08a5baf60 | ||
|
265cacf3dc | ||
|
4bc92bcce8 | ||
|
ed50751518 | ||
|
7b514fbd7e | ||
|
fce8b69459 | ||
|
17935970fb | ||
|
1e3b54d1f4 | ||
|
69d44d5ea0 | ||
|
21c444c8a4 | ||
|
51b4d42e8d | ||
|
bc80b9f60b | ||
|
d4a6e7189c | ||
|
fa77db52b6 | ||
|
767e49f27c | ||
|
3407968a32 | ||
|
4c5bda4858 | ||
|
720a51ff82 | ||
|
3bd7041426 | ||
|
c930aaf0b2 | ||
|
f43285e0bb | ||
|
7e022fe132 | ||
|
da2f21c0f6 | ||
|
8df08c4b1f | ||
|
e8bb4070d9 | ||
|
14e7619075 | ||
|
67658e172c | ||
|
3a716bcf9a | ||
|
51e4325f0b | ||
|
264f49fd2c | ||
|
3f5fe6f3e5 | ||
|
250eff740e | ||
|
523a0bec2c | ||
|
5337656c58 | ||
|
5270501fac | ||
|
f05c36c29e | ||
|
44b5e36905 | ||
|
c6caffcdf8 | ||
|
81a7fc52a8 | ||
|
146cbb598a | ||
|
c832db9ddb | ||
|
faf365baa1 | ||
|
8a274f8409 | ||
|
e68dbe4e67 | ||
|
3a5759e2b5 | ||
|
f21e9cc0ae | ||
|
1efb97733d | ||
|
28f9b55e4f | ||
|
2efa6eed7c | ||
|
f28605cdf8 | ||
|
9b6947dc98 | ||
|
34ac1a7002 | ||
|
33207b158a | ||
|
9229dd07d4 | ||
|
491e08ff91 | ||
|
3464abbde3 | ||
|
da0e1dbd5b | ||
|
0db7e7c533 | ||
|
97ca61ac97 | ||
|
3e2d6eb5fa | ||
|
ecd95ba2d2 | ||
|
4e46fff145 | ||
|
0bd2d176d8 | ||
|
06a785d770 | ||
|
d372e1029f | ||
|
787d1a3ba9 | ||
|
b6b695290c | ||
|
275ea37a01 | ||
|
98eb3c9013 | ||
|
dbc047516d | ||
|
94d63306d4 | ||
|
2ba50f2a73 | ||
|
59429b097d | ||
|
e1ad1f3065 | ||
|
b0c175dd57 | ||
|
d3d6161c22 | ||
|
59e4c5b673 | ||
|
da660a7ad8 | ||
|
7b8b8aca0c | ||
|
c55b542204 | ||
|
10772c2190 | ||
|
d6254ebba6 | ||
|
681dd85ce6 | ||
|
a1aafbeade | ||
|
c17678013d | ||
|
33ec8528a1 | ||
|
b9d1017754 | ||
|
7b4c77b7da | ||
|
7234f83073 | ||
|
a02e2a2247 | ||
|
52023a4db0 | ||
|
4c2b52cdbb | ||
|
45da40e4c9 | ||
|
3a02a2a4b3 | ||
|
57f1bac497 | ||
|
3e8bbd02ea | ||
|
82c89668a0 | ||
|
b790b27000 | ||
|
8436b74ac1 | ||
|
4c0f7650dd | ||
|
73391b06e4 | ||
|
cfd3c731ba | ||
|
a6d18e286a | ||
|
324666a3ec | ||
|
6de0449b8c | ||
|
fccd062b85 | ||
|
1b1ce69378 | ||
|
bba54368f4 | ||
|
ac31ea2291 | ||
|
991119e5c5 | ||
|
24cf82cc53 | ||
|
f4886fdb7a | ||
|
923d70e0df | ||
|
6c2c52abf2 | ||
|
16c1b2ad87 | ||
|
3291ce008a | ||
|
31fb0208d0 | ||
|
2ef3c24b67 | ||
|
d46108ac05 | ||
|
50cc9669c5 | ||
|
c0ff2847fe | ||
|
c0bc6842d5 | ||
|
0f5b9d1397 | ||
|
b75beba06b | ||
|
4b629db0d9 | ||
|
e4895d7119 | ||
|
704ca22fed | ||
|
7422cc3822 | ||
|
0bc6965681 | ||
|
7a70ed75be | ||
|
7a7df7d4a7 | ||
|
a2e705adb0 | ||
|
30530a8593 | ||
|
edcb6d0ca4 | ||
|
4160d4e770 | ||
|
582e29aab6 | ||
|
d59dc6ee5b | ||
|
e48452dd9d | ||
|
d405308d1d | ||
|
ce1f2b30e4 | ||
|
5e18538f14 | ||
|
ab94bd34ac | ||
|
d94e28fa2d | ||
|
b6dc9e8ca0 | ||
|
452e6f20db | ||
|
00ccf8a95b | ||
|
83018d252c | ||
|
1f9c100ad5 | ||
|
cadf7e718b | ||
|
1324e8ffe3 | ||
|
e9bd5e2fb9 | ||
|
b62969e07c | ||
|
1e90f33aae | ||
|
f14158a358 | ||
|
f1d240d5fc | ||
|
d2d1be764d | ||
|
292122b8e5 | ||
|
30f9311fd1 | ||
|
9a9c5ed85f | ||
|
db68c9cce8 | ||
|
ae61d2f7ad | ||
|
4f8a4c9dc2 | ||
|
e593a0d007 | ||
|
7ddf4a566d | ||
|
0801f9bf4c | ||
|
29da0bf82e | ||
|
6319f8d922 | ||
|
eca0d0bf48 | ||
|
75f6e84fb0 | ||
|
f96cb98a67 | ||
|
2b19ccea1c | ||
|
122ea31e45 | ||
|
d1a7d5d8c4 | ||
|
375c296f56 | ||
|
540535b95e | ||
|
4fc8185058 | ||
|
561f4d16a0 | ||
|
26d695265d | ||
|
92e16b7197 | ||
|
769e8b34ba | ||
|
895320dbd8 | ||
|
9015134418 | ||
|
470f726a5b | ||
|
4e658dde00 | ||
|
9b086f4c41 | ||
|
6eb57a9ade | ||
|
4b26402b28 | ||
|
c2e240014d | ||
|
60895c84a2 | ||
|
372ec72491 | ||
|
d520ef67f8 | ||
|
3681cba45d | ||
|
76545d196b | ||
|
379d035b63 | ||
|
f7fc82dca1 | ||
|
f143efe4e2 | ||
|
5f61a90eb7 | ||
|
5bbddcf2ee | ||
|
2e7f242056 | ||
|
b4e3b7e3a2 | ||
|
135518a341 | ||
|
b07f3c5e67 | ||
|
c308d1b6c2 | ||
|
2da3344612 | ||
|
2b2cdf912b | ||
|
15a88c2566 | ||
|
eff0d55c28 | ||
|
66c8cba965 | ||
|
c9bfbb0771 | ||
|
85217be1b5 | ||
|
0104f97805 | ||
|
774c465f57 | ||
|
5a39bc00ce | ||
|
ca81aa5134 | ||
|
08c7e768c0 | ||
|
d76f6807cc | ||
|
1626d176b0 | ||
|
2a944b3f0a | ||
|
a6a75ee691 | ||
|
2831152015 | ||
|
f4f2901e58 | ||
|
6ec608f539 | ||
|
404453cadd | ||
|
1f82d26ac2 | ||
|
b5fd3de755 | ||
|
58644228ea | ||
|
8b739fa321 | ||
|
5f57edb212 | ||
|
ad3796f5a8 | ||
|
c82b6d8f94 | ||
|
743aa0992f | ||
|
007c1773a8 | ||
|
3ee4980412 | ||
|
71a5ad3fab | ||
|
34b7ef1a60 | ||
|
f19f1ee86d | ||
|
b85b3f7ccc | ||
|
c1eb75de1a | ||
|
7413ffabb1 | ||
|
778f3e279c | ||
|
cff4c061b2 | ||
|
9d38f5439d | ||
|
c6ab669edf | ||
|
9a9f3804e8 | ||
|
cc2ff457e6 | ||
|
e846fdeef8 | ||
|
f86f099fa5 | ||
|
eb11ec34f2 | ||
|
8bc2103b0c | ||
|
fb3ea54854 | ||
|
4f0b0fedb8 | ||
|
c4bdf74942 | ||
|
bf84bfe4b0 | ||
|
32bb91a1a2 | ||
|
3a65dad743 | ||
|
5dbce09e4f | ||
|
9244d60abe | ||
|
ae13a3394d | ||
|
a4a3d4e531 | ||
|
56f9435c03 | ||
|
d8e30af188 |
@ -504,9 +504,584 @@
|
||||
"name": "Sean DuBois",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/1302304?v=4",
|
||||
"profile": "http://siobud.com",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "gary-kim",
|
||||
"name": "Gary Kim",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/47195730?v=4",
|
||||
"profile": "https://github.com/gary-kim",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "DylanBartels",
|
||||
"name": "Dylan",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/6660171?v=4",
|
||||
"profile": "https://dylanbartels.com",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "l13t",
|
||||
"name": "Dmytro Prokhorenkov",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/1990354?v=4",
|
||||
"profile": "http://liet.me",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "elliotrushton",
|
||||
"name": "Elliot",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/590442?v=4",
|
||||
"profile": "https://github.com/elliotrushton",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "chenrui333",
|
||||
"name": "chenrui",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/1580956?v=4",
|
||||
"profile": "http://chenrui.dev",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "sudermanjr",
|
||||
"name": "Andrew Suderman",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/7624765?v=4",
|
||||
"profile": "https://github.com/sudermanjr",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "rwhogg",
|
||||
"name": "Bob 'Wombat' Hogg",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/2373856?v=4",
|
||||
"profile": "https://github.com/rwhogg",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "hxw",
|
||||
"name": "Christopher Hall",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/143462?v=4",
|
||||
"profile": "https://github.com/hxw",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "hneiva",
|
||||
"name": "Heitor Neiva",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/3451557?v=4",
|
||||
"profile": "https://github.com/hneiva",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "herbygillot",
|
||||
"name": "Herby Gillot",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/618376?v=4",
|
||||
"profile": "https://github.com/herbygillot",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "brudil",
|
||||
"name": "James Canning",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/382352?v=4",
|
||||
"profile": "http://brudil.com",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "jeffz",
|
||||
"name": "jeffz",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/45892?v=4",
|
||||
"profile": "https://twitter.com/jeffz4000",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "mikkeljuhl",
|
||||
"name": "Mikkel Jeppesen Juhl",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/1764035?v=4",
|
||||
"profile": "https://mikkeljuhl.com",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "lesteenman",
|
||||
"name": "Erik",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/963290?v=4",
|
||||
"profile": "https://github.com/lesteenman",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "nyourchuck",
|
||||
"name": "Nate Yourchuck",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/155574?v=4",
|
||||
"profile": "https://github.com/nyourchuck",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "Ameobea",
|
||||
"name": "Casey Primozic",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/4335849?v=4",
|
||||
"profile": "https://cprimozic.net/",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "andor-pierdelacabeza",
|
||||
"name": "Alvaro [Andor]",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/2430915?v=4",
|
||||
"profile": "http://pierdelacabeza.com/maruja",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "Midnight-Conqueror",
|
||||
"name": "Joel Valentine",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/17101621?v=4",
|
||||
"profile": "https://github.com/Midnight-Conqueror",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "v-braun",
|
||||
"name": "Viktor Braun",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/4738210?v=4",
|
||||
"profile": "https://www.viktor-braun.de",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "ChrisDBrown",
|
||||
"name": "ChrisDBrown",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/3877652?v=4",
|
||||
"profile": "https://www.chrisdbrown.co.uk/",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "Narengowda",
|
||||
"name": "Narendra L",
|
||||
"avatar_url": "https://avatars2.githubusercontent.com/u/582821?v=4",
|
||||
"profile": "https://narengowda.github.io/",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "ibaum",
|
||||
"name": "ibaum",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/24609103?v=4",
|
||||
"profile": "https://github.com/ibaum",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "noxer",
|
||||
"name": "Tim Scheuermann",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/566185?v=4",
|
||||
"profile": "https://github.com/noxer",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "indradhanush",
|
||||
"name": "Indradhanush Gupta",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/2682729?v=4",
|
||||
"profile": "https://indradhanush.github.io/",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "VictorAvelar",
|
||||
"name": "Victor Hugo Avelar Ossorio",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/7926849?v=4",
|
||||
"profile": "https://victoravelar.com",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "scw007",
|
||||
"name": "Steven Whitehead",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/4001640?v=4",
|
||||
"profile": "https://github.com/scw007",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "lawrencecraft",
|
||||
"name": "Lawrence Craft",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/660580?v=4",
|
||||
"profile": "https://github.com/lawrencecraft",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "aviaviavi",
|
||||
"name": "Avi Press",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/1388071?v=4",
|
||||
"profile": "http://avi.press",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "Tardog",
|
||||
"name": "Sarah Kraßnigg",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/22562624?v=4",
|
||||
"profile": "https://github.com/Tardog",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "jmks",
|
||||
"name": "Jason Schweier",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/4923990?v=4",
|
||||
"profile": "http://jmks.ca",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "massa1240",
|
||||
"name": "Massa",
|
||||
"avatar_url": "https://avatars2.githubusercontent.com/u/8268483?v=4",
|
||||
"profile": "https://github.com/massa1240",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "Boot-Error",
|
||||
"name": "Vighnesh SK",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/8546140?v=4",
|
||||
"profile": "http://boot-error.github.io",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "alexfornuto",
|
||||
"name": "Alex Fornuto",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/2349184?v=4",
|
||||
"profile": "http://alexfornuto.com",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "stevenwhitehead",
|
||||
"name": "stevenwhitehead",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/30630257?v=4",
|
||||
"profile": "https://github.com/stevenwhitehead",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "jdenoy-saagie",
|
||||
"name": "Johan Denoyer",
|
||||
"avatar_url": "https://avatars2.githubusercontent.com/u/55875303?v=4",
|
||||
"profile": "https://github.com/jdenoy-saagie",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "caalberts",
|
||||
"name": "Albert Salim",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/4749355?v=4",
|
||||
"profile": "https://albertsalim.dev",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "felicianotech",
|
||||
"name": "Ricardo N Feliciano",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/6017470?v=4",
|
||||
"profile": "https://Feliciano.Tech",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "3mard",
|
||||
"name": "Omer Davutoglu",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/42009880?v=4",
|
||||
"profile": "https://github.com/3mard",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "hemu",
|
||||
"name": "Hemu",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/1871299?v=4",
|
||||
"profile": "https://github.com/hemu",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "Daanikus",
|
||||
"name": "Dan Bent",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/18027087?v=4",
|
||||
"profile": "https://github.com/Daanikus",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "C123R",
|
||||
"name": "C123R",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/20225764?v=4",
|
||||
"profile": "https://cizer.dev",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "madepolli",
|
||||
"name": "Matjaž Depolli",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/7237000?v=4",
|
||||
"profile": "https://github.com/madepolli",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "schoentoon",
|
||||
"name": "Toon Schoenmakers",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/417618?v=4",
|
||||
"profile": "https://blog.schoentoon.blue",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "TDHTTTT",
|
||||
"name": "TDHTTTT",
|
||||
"avatar_url": "https://avatars2.githubusercontent.com/u/24703459?v=4",
|
||||
"profile": "http://tdhttt.com",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "jottr",
|
||||
"name": "jottr",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/2744198?v=4",
|
||||
"profile": "https://github.com/jottr",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "NickyMateev",
|
||||
"name": "Nikolay Mateev",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/15074116?v=4",
|
||||
"profile": "https://www.linkedin.com/in/nikolay-mateev-79187b167/",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "Gibstick",
|
||||
"name": "Charlie Wang",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/1320418?v=4",
|
||||
"profile": "https://charliewang.io",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "liyiheng",
|
||||
"name": "liyiheng",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/16461061?v=4",
|
||||
"profile": "https://github.com/liyiheng",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "bjoernw",
|
||||
"name": "Bjoern Weidlich",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/1467156?v=4",
|
||||
"profile": "https://bjoern.svbtle.com",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "firecat53",
|
||||
"name": "Scott Hansen",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/568113?v=4",
|
||||
"profile": "https://github.com/firecat53",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "davidsbond",
|
||||
"name": "David Bond",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/6227720?v=4",
|
||||
"profile": "https://davidsbond.github.io",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "yesnault",
|
||||
"name": "Yvonnick Esnault",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/395454?v=4",
|
||||
"profile": "https://github.com/yesnault",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "leterio",
|
||||
"name": "Vinícius Letério",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/15060358?v=4",
|
||||
"profile": "https://github.com/leterio",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "acaloiaro",
|
||||
"name": "Adriano",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/3331648?v=4",
|
||||
"profile": "https://adriano.fyi",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "jonhadfield",
|
||||
"name": "Jon Hadfield",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/843944?v=4",
|
||||
"profile": "https://github.com/jonhadfield",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "Tdnshah",
|
||||
"name": "Tejas Shah",
|
||||
"avatar_url": "https://avatars2.githubusercontent.com/u/13272752?v=4",
|
||||
"profile": "https://github.com/Tdnshah",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "mogensen",
|
||||
"name": "Frederik Mogensen",
|
||||
"avatar_url": "https://avatars2.githubusercontent.com/u/592710?v=4",
|
||||
"profile": "https://github.com/mogensen",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "rsaarelm",
|
||||
"name": "Risto Saarelma",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/41840?v=4",
|
||||
"profile": "https://github.com/rsaarelm",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "sam-github",
|
||||
"name": "Sam Roberts",
|
||||
"avatar_url": "https://avatars2.githubusercontent.com/u/17607?v=4",
|
||||
"profile": "https://sam-github.github.io/",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "gerchardon",
|
||||
"name": "gerchardon",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/5973160?v=4",
|
||||
"profile": "https://github.com/gerchardon",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "mryanmurphy",
|
||||
"name": "Matt",
|
||||
"avatar_url": "https://avatars2.githubusercontent.com/u/641427?v=4",
|
||||
"profile": "https://github.com/mryanmurphy",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "ripienaar",
|
||||
"name": "R.I.Pienaar",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/82342?v=4",
|
||||
"profile": "http://devco.net/",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "fmotrifork",
|
||||
"name": "Frederik Mogensen",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/18327738?v=4",
|
||||
"profile": "https://github.com/fmotrifork",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "aeter",
|
||||
"name": "aeter",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/238607?v=4",
|
||||
"profile": "https://github.com/aeter",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "timhwang21",
|
||||
"name": "Tim Hwang",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/5831434?v=4",
|
||||
"profile": "http://timhwang21.gitbook.io",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "cyingfan",
|
||||
"name": "Ying Fan Chong",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/10404961?v=4",
|
||||
"profile": "http://about.me/yingfan",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "MartinJohns",
|
||||
"name": "Martin Johns",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/5269069?v=4",
|
||||
"profile": "https://github.com/MartinJohns",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "jamietanna",
|
||||
"name": "Jamie Tanna",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/3315059?v=4",
|
||||
"profile": "https://www.jvt.me",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "trimble",
|
||||
"name": "Todd Trimble",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/371317?v=4",
|
||||
"profile": "https://github.com/trimble",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "mhanberg",
|
||||
"name": "Mitchell Hanberg",
|
||||
"avatar_url": "https://avatars2.githubusercontent.com/u/5523984?v=4",
|
||||
"profile": "https://www.mitchellhanberg.com",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "franga2000",
|
||||
"name": "Miha Frangež",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/3891092?v=4",
|
||||
"profile": "https://franga2000.com",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "sahilister",
|
||||
"name": "Sahil Dhiman",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/52946452?v=4",
|
||||
"profile": "https://blog.sahilister.in/",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "applegreengrape",
|
||||
"name": "Pingzhou | 平舟",
|
||||
"avatar_url": "https://avatars2.githubusercontent.com/u/17727004?v=4",
|
||||
"profile": "https://pzoo.netlify.app/",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "YuviGold",
|
||||
"name": "Yuval Goldberg",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/29873449?v=4",
|
||||
"profile": "https://github.com/YuviGold",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "dabcoder",
|
||||
"name": "David Bouchare",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/5034531?v=4",
|
||||
"profile": "https://github.com/dabcoder",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "stone",
|
||||
"name": "Fredrik Steen",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/29077?v=4",
|
||||
"profile": "https://github.com/stone",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "zye1996",
|
||||
"name": "zye1996",
|
||||
"avatar_url": "https://avatars2.githubusercontent.com/u/28901953?v=4",
|
||||
"profile": "https://github.com/zye1996",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "pgaxatte",
|
||||
"name": "Pierre Gaxatte",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/30696904?v=4",
|
||||
"profile": "https://github.com/pgaxatte",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "xntrik",
|
||||
"name": "Christian Frichot",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/678260?v=4",
|
||||
"profile": "https://xntrik.wtf",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "LKaemmerling",
|
||||
"name": "Lukas Kämmerling",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/4281581?v=4",
|
||||
"profile": "https://lukas-kaemmerling.de",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "inetAnt",
|
||||
"name": "Antoine Meillet",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/1765366?v=4",
|
||||
"profile": "https://inetant.net/",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "cclauss",
|
||||
"name": "Christian Clauss",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/3709715?v=4",
|
||||
"profile": "https://www.patreon.com/cclauss",
|
||||
"contributions": [
|
||||
]
|
||||
}
|
||||
],
|
||||
"contributorsPerLine": 7
|
||||
"contributorsPerLine": 7,
|
||||
"commitConvention": "none"
|
||||
}
|
||||
|
1
.github/FUNDING.yml
vendored
Normal file
1
.github/FUNDING.yml
vendored
Normal file
@ -0,0 +1 @@
|
||||
github: senorprogrammer
|
16
.github/ISSUE_TEMPLATE/Bug.md
vendored
16
.github/ISSUE_TEMPLATE/Bug.md
vendored
@ -1,16 +1,6 @@
|
||||
---
|
||||
name: Bug Report
|
||||
about: Something is broken?
|
||||
name: 🐞 Report a Bug
|
||||
about: Tell us what's broken
|
||||
---
|
||||
|
||||
#### What's the problem?
|
||||
|
||||
|
||||
#### How did you expect it to behave?
|
||||
|
||||
|
||||
#### Operating system
|
||||
|
||||
#### Terminal program & version
|
||||
|
||||
#### WTF version
|
||||
## What's broken?
|
||||
|
11
.github/ISSUE_TEMPLATE/Feature.md
vendored
11
.github/ISSUE_TEMPLATE/Feature.md
vendored
@ -1,11 +1,6 @@
|
||||
---
|
||||
name: Feature Request
|
||||
about: You have a neat idea that should be implemented?
|
||||
name: ⚡️ Request a Feature
|
||||
about: Tell us what it should do
|
||||
---
|
||||
|
||||
#### What problem does this solve?
|
||||
|
||||
|
||||
#### How do envision it working?
|
||||
|
||||
|
||||
## What should it do?
|
||||
|
6
.github/ISSUE_TEMPLATE/Support.md
vendored
6
.github/ISSUE_TEMPLATE/Support.md
vendored
@ -1,8 +1,8 @@
|
||||
---
|
||||
name: ❓ Support Question
|
||||
about: Have a problem that you can't figure out?
|
||||
name: ❓Ask a Question
|
||||
about: Tell us how we can help
|
||||
---
|
||||
|
||||
#### What problem are you having and how can we help?
|
||||
## How can we help?
|
||||
|
||||
|
||||
|
5
.github/PULL_REQUEST_TEMPLATE/Improvement.md
vendored
5
.github/PULL_REQUEST_TEMPLATE/Improvement.md
vendored
@ -3,9 +3,6 @@ name: Improvement
|
||||
about: You have some improvement to make wtf better?
|
||||
---
|
||||
|
||||
#### What problem does this solve?
|
||||
|
||||
|
||||
#### Is this related to an existing Issue? If so, which one?
|
||||
Thanks for submitting a pull request. Please provide enough information so that others can review your pull request.
|
||||
|
||||
|
||||
|
4
.github/PULL_REQUEST_TEMPLATE/Other.md
vendored
4
.github/PULL_REQUEST_TEMPLATE/Other.md
vendored
@ -3,9 +3,7 @@ name: Other
|
||||
about: You have some other ideas you want to introduce?
|
||||
---
|
||||
|
||||
<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. -->
|
||||
|
||||
#### What problem does this solve?
|
||||
Thanks for submitting a pull request. Please provide enough information so that others can review your pull request.
|
||||
|
||||
|
||||
|
||||
|
11
.github/dependabot.yml
vendored
Normal file
11
.github/dependabot.yml
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: gomod
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: daily
|
||||
open-pull-requests-limit: 10
|
||||
reviewers:
|
||||
- senorprogrammer
|
||||
assignees:
|
||||
- senorprogrammer
|
51
.github/workflows/codeql-analysis.yml
vendored
Normal file
51
.github/workflows/codeql-analysis.yml
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
name: "Code scanning - action"
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
schedule:
|
||||
- cron: '0 3 * * 3,6'
|
||||
|
||||
jobs:
|
||||
CodeQL-Build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
# We must fetch at least the immediate parents so that if this is
|
||||
# a pull request then we can checkout the head.
|
||||
fetch-depth: 2
|
||||
|
||||
# If this run was triggered by a pull request event, then checkout
|
||||
# the head of the pull request instead of the merge commit.
|
||||
- run: git checkout HEAD^2
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
# Override language selection by uncommenting this and choosing your languages
|
||||
# with:
|
||||
# languages: go, javascript, csharp, python, cpp, java
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v1
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
|
||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||
# and modify them (or add more) to build your code if your project
|
||||
# uses a compiled language
|
||||
|
||||
#- run: |
|
||||
# make bootstrap
|
||||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v1
|
22
.github/workflows/golangci-lint.yml
vendored
Normal file
22
.github/workflows/golangci-lint.yml
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
name: golangci-lint
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- v*
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
jobs:
|
||||
golangci:
|
||||
name: lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v2
|
||||
with:
|
||||
# Required: the version of golangci-lint is required and must be
|
||||
# specified without patch version: we always use the latest patch version.
|
||||
# https://github.com/golangci/golangci-lint/releases
|
||||
version: v1.39
|
||||
args: ./...
|
30
.github/workflows/goreleaser.yml
vendored
Normal file
30
.github/workflows/goreleaser.yml
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
name: goreleaser
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
goreleaser:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
-
|
||||
name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.16
|
||||
-
|
||||
name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v2
|
||||
with:
|
||||
version: latest
|
||||
args: release --rm-dist
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
|
70
.github/workflows/staticcheck.yml
vendored
Normal file
70
.github/workflows/staticcheck.yml
vendored
Normal file
@ -0,0 +1,70 @@
|
||||
name: static check
|
||||
on: pull_request
|
||||
|
||||
jobs:
|
||||
imports:
|
||||
name: Imports
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- name: check
|
||||
uses: grandcolline/golang-github-actions@4356d0458ea4bfdb55fcb296437812acef970f9b
|
||||
with:
|
||||
run: imports
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
errcheck:
|
||||
name: Errcheck
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- name: check
|
||||
uses: grandcolline/golang-github-actions@4356d0458ea4bfdb55fcb296437812acef970f9b
|
||||
with:
|
||||
run: errcheck
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
#lint:
|
||||
#name: Lint
|
||||
#runs-on: ubuntu-latest
|
||||
#steps:
|
||||
#- uses: actions/checkout@master
|
||||
#- name: check
|
||||
#uses: grandcolline/golang-github-actions@4356d04
|
||||
#with:
|
||||
#run: lint
|
||||
#token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
shadow:
|
||||
name: Shadow
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- name: check
|
||||
uses: grandcolline/golang-github-actions@4356d0458ea4bfdb55fcb296437812acef970f9b
|
||||
with:
|
||||
run: shadow
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
staticcheck:
|
||||
name: StaticCheck
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- name: check
|
||||
uses: grandcolline/golang-github-actions@4356d0458ea4bfdb55fcb296437812acef970f9b
|
||||
with:
|
||||
run: staticcheck
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
#sec:
|
||||
#name: Sec
|
||||
#runs-on: ubuntu-latest
|
||||
#steps:
|
||||
#- uses: actions/checkout@master
|
||||
#- name: check
|
||||
#uses: grandcolline/golang-github-actions@4356d04
|
||||
#with:
|
||||
#run: sec
|
||||
#token: ${{ secrets.GITHUB_TOKEN }}
|
||||
#flags: "-exclude=G104"
|
18
.golangci.yml
Normal file
18
.golangci.yml
Normal file
@ -0,0 +1,18 @@
|
||||
run:
|
||||
timeout: 2m
|
||||
|
||||
linters:
|
||||
enable:
|
||||
- vet
|
||||
- errcheck
|
||||
- staticcheck
|
||||
# - dupl
|
||||
# - funlen
|
||||
# - goconst
|
||||
# - gocritic
|
||||
- gofmt
|
||||
# - golint
|
||||
# - misspell
|
||||
# - stylecheck
|
||||
- unconvert
|
||||
# - whitespace
|
@ -1,19 +1,30 @@
|
||||
before:
|
||||
hooks:
|
||||
- make install
|
||||
env:
|
||||
- GO111MODULE=on
|
||||
- GOPROXY="https://proxy.golang.org,direct"
|
||||
|
||||
archives:
|
||||
- id: default
|
||||
wrap_in_directory: true
|
||||
|
||||
builds:
|
||||
- binary: wtf
|
||||
- binary: wtfutil
|
||||
goos:
|
||||
- darwin
|
||||
- linux
|
||||
goarch:
|
||||
- 386
|
||||
- amd64
|
||||
- arm
|
||||
- arm64
|
||||
|
||||
env:
|
||||
- GO111MODULE=on
|
||||
- GOPROXY="https://gocenter.io"
|
||||
before:
|
||||
hooks:
|
||||
- make install
|
||||
|
||||
archive:
|
||||
wrap_in_directory: true
|
||||
brews:
|
||||
-
|
||||
name: wtfutil
|
||||
homepage: 'https://wtfutil.com'
|
||||
description: 'The personal information dashboard for your terminal.'
|
||||
tap:
|
||||
owner: wtfutil
|
||||
name: homebrew-wtfutil
|
||||
|
10
.travis.yml
10
.travis.yml
@ -1,14 +1,14 @@
|
||||
language: go
|
||||
|
||||
go:
|
||||
- "1.11.x"
|
||||
- "1.12.x"
|
||||
sudo: false
|
||||
- "1.16.x"
|
||||
|
||||
before_install:
|
||||
# Make sure travis builds work for forks
|
||||
- mkdir -p $TRAVIS_BUILD_DIR $GOPATH/src/github.com/wtfutil
|
||||
- test ! -d $GOPATH/src/github.com/wtfutil/wtf && mv $TRAVIS_BUILD_DIR $GOPATH/src/github.com/wtfutil/wtf || true
|
||||
- export TRAVIS_BUILD_DIR=$HOME/gopath/src/github.com/wtfutil/wtf
|
||||
- cd $HOME/gopath/src/github.com/wtfutil/wtf
|
||||
- export GOPROXY="https://gocenter.io" && export GO111MODULE=on
|
||||
- export GOPROXY="https://proxy.golang.org,direct"
|
||||
|
||||
script: go get ./... && go get github.com/go-test/deep && go test -v github.com/wtfutil/wtf/wtf_tests/...
|
||||
script: go get ./... && ./scripts/check-uncommitted-vendor-files.sh && go test -v github.com/wtfutil/wtf/...
|
||||
|
468
CHANGELOG.md
468
CHANGELOG.md
@ -2,6 +2,468 @@
|
||||
|
||||
## Unreleased
|
||||
|
||||
### ⚡️ Added
|
||||
|
||||
* Yahoo Finance module added, by [@inetAnt](https://github.com/inetAnt)
|
||||
|
||||
### 🐞 Fixed
|
||||
|
||||
* Fixed error closing the Jira module response body, [#1070](https://github.com/wtfutil/wtf/issues/1070) by [@senorprogrammer](https://github.com/senorprogrammer)
|
||||
|
||||
## v0.36.0
|
||||
|
||||
### ⚡️ Added
|
||||
|
||||
* HealthChecks module added, by [@stone](https://github.com/stone)
|
||||
* Asana module added, by [@xntrik](https://github.com/xntrik)
|
||||
* Kubernetes module now displays the Ready Replicas and Total Replicas count, by [@LKaemmerling](https://github.com/LKaemmerling)
|
||||
* Now builds using Go 1.16, which provides support for Apple's M1 ARM hardware, by [@LKaemmerling](https://github.com/LKaemmerling)
|
||||
|
||||
### 🐞 Fixed
|
||||
|
||||
* Numerous dangling response bodies closed, by [@dabcoder](https://github.com/dabcoder)
|
||||
* HackerNews read-on-response error fixed, by [@LKaemmerling](https://github.com/LKaemmerling)
|
||||
* CircleCI read-on-response error fixed, by [@dabcoder](https://github.com/dabcoder)
|
||||
|
||||
## v0.35.0
|
||||
|
||||
### ⚡️ Added
|
||||
|
||||
* CircleCI module now supports `numberOfBuilds` setting defining how many builds to display, [#1020](https://github.com/wtfutil/wtf/issues/1020) by [@dabcoder](https://github.com/dabcoder)
|
||||
* The <kbd>\\</kbd> key now opens module documentation in the browser for the currently-focused module, by [@senorprogrammer](https://github.com/senorprogrammer)
|
||||
* Krisinformation module added, by [@stone](https://github.com/stone)
|
||||
* Covid module has been added, by [@dabcoder](https://github.com/dabcoder)
|
||||
* Support for a "Language" configuration key added. Supports any BCP 47 tag for identifying a langauge, by [@senorprogrammer](https://github.com/senorprogrammer)
|
||||
|
||||
### 🐞 Fixed
|
||||
|
||||
* CryptoLive prices update again, [#1041](https://github.com/wtfutil/wtf/issues/1041) by [@zye1996](https://github.com/zye1996)
|
||||
|
||||
## v0.34.0
|
||||
2020-11-08
|
||||
|
||||
### ⚡️ Added
|
||||
|
||||
* DigitalOcean module now supports custom column definitions in the default layout. See [the docs](https://wtfutil.com/modules/digitalocean/) for details, [#986](https://github.com/wtfutil/wtf/issues/986) by [@senorprogrammer](https://github.com/senorprogrammer)
|
||||
* Finnhub stock quotes module added, [#930](https://github.com/wtfutil/wtf/issues/930) by [@applegreengrape](https://github.com/applegreengrape)
|
||||
* Grafana Alerts module added, by [@schoentoon](https://github.com/schoentoon)
|
||||
|
||||
### 👍 Updated
|
||||
|
||||
* Updated `google.golang.org/api` from 0.30.0 to 0.33.0
|
||||
* Updated `github.com/digitalocean/godo` from 1.46.0 to 1.52.0
|
||||
* Updated `github.com/xanzy/go-gitlab` from 0.38.1 to 0.39.0
|
||||
* Updated `github.com/zorkian/go-datadog-api` from 2.29.0+incompatible to 2.30.0+incompatible
|
||||
* Updated `golang.org/x/text` from 0.3.3 to 0.3.4
|
||||
|
||||
## v0.33.0
|
||||
2020-10-13
|
||||
|
||||
### ⚡️ Added
|
||||
|
||||
* FeedReader module supports [display mode switching](https://github.com/wtfutil/wtf/pull/976) via the `t` key, by [@cyingfan](https://github.com/cyingfan)
|
||||
* Clocks module now supports `natural` ordering option, [#896](https://github.com/wtfutil/wtf/issues/896) by [@seanstoppable](https://github.com/Seanstoppable)
|
||||
* Exit banner message added, by [@senorprogrammer](https://github.com/senorprogrammer)
|
||||
* [UptimeRobot module added](https://github.com/wtfutil/wtf/pull/983), by [@franga2000](https://github.com/franga2000)
|
||||
* Gitlab module now defaults the domain to `https://gitlab.com`, by [@jmks](https://github.com/jmks)
|
||||
|
||||
### 🐞 Fixed
|
||||
|
||||
* Exchange Rates module now displays rates in alphabetical order, sorted by the base rate, by [@senorprogrammer](https://github.com/senorprogrammer)
|
||||
* Feed Reader module no longer crashes on feeds that don't have a published date, [#958](https://github.com/wtfutil/wtf/issues/958) by [@cyingfan](https://github.com/cyingfan)
|
||||
* Stray blank lines no longer appear at the end of highlightable lists, [#977](https://github.com/wtfutil/wtf/pull/977) by [@cyingfan](https://github.com/cyingfan)
|
||||
* `config.yml` now properly set to `0600` instead of `0666`, by [@cyingfan](https://github.com/cyingfan)
|
||||
* Now blank-imports the `time/tzinfo` package to provide timezone support for Windows users, [#994](https://github.com/wtfutil/wtf/issues/994) by [@trimble](https://github.com/trimble)
|
||||
|
||||
### 👍 Updated
|
||||
|
||||
* Updated `github.com/gdamore/tcell` from 1.3.0 to 1.4.0
|
||||
* Updated `github.com/shirou/gopsutil` from 2.20.7+incompatible to 2.20.9+incompatible
|
||||
* Updated `github.com/mmcdole/gofeed` from 1.0.0 to 1.1.0
|
||||
* Updated `github.com/digitalocean/godo` from 1.42.1 to 1.46.0
|
||||
* Updated `github.com/xanzy/go-gitlab` from 0.33.0 to 0.38.1
|
||||
* Updated `github.com/adlio/trello` from 1.7.0 to 1.8.0
|
||||
* Updated `github.com/alecthomas/chroma` from 0.8.0 to 0.8.1
|
||||
* Updated `github.com/nicklaw5/helix` from 0.5.9 to 0.7.0
|
||||
|
||||
* Now requires Go 1.15 for compilation in Dockerfiles and go.mod, by [@seanstoppable](https://github.com/Seanstoppable)
|
||||
|
||||
## v0.32.0
|
||||
|
||||
### ⚡️ Added
|
||||
|
||||
* PagerDuty module now supports `showOncallEnd` setting, which determines whether or not to display the oncall rotation end date, by [@senorprogrammer](https://github.com/senorprogrammer)
|
||||
* Exchange Rates module now supports `precision` setting, which determines how many decimal places to display, [#897](https://github.com/wtfutil/wtf/issues/897) by [@senorprogrammer](https://github.com/senorprogrammer)
|
||||
|
||||
### 🐞 Fixed
|
||||
|
||||
* Todo module's edit modal now shows up quickly, [#876](https://github.com/wtfutil/wtf/issues/876) by [@aeter](https://github.com/aeter)
|
||||
* Jira module title now displays properly, [#942](https://github.com/wtfutil/wtf/issues/942) by [@timhwang21](https://github.com/timhwang21)
|
||||
|
||||
### 👍 Updated
|
||||
|
||||
* Updated `alecthomas/chroma` from 0.7.3 to 0.8.0
|
||||
* Updated `digitalocean/godo` from 1.38.0 to 1.42.1
|
||||
* Updated `google.golang.org/api` from 0.29.0 to 0.30.0
|
||||
* Updated `shirou/gopsutil` from 2.20.6+incompatible to 2.20.7+incompatible
|
||||
|
||||
## v0.31.0
|
||||
|
||||
### ⚡️ Added
|
||||
|
||||
* [docker-credential-helpers](https://github.com/docker/docker-credential-helpers) support added to provide optional securing of module secrets, [#517](https://github.com/wtfutil/wtf/issues/517) by [@sam-github](https://github.com/sam-github)
|
||||
* `make lint` now uses [golangci-lint](https://github.com/golangci/golangci-lint-action), by [@sam-github](https://github.com/sam-github)
|
||||
* GitHub module now supports per-section configuration, [#864](https://github.com/wtfutil/wtf/issues/864) by [@mryanmurphy](https://github.com/mryanmurphy)
|
||||
* PagerDuty module now accepts Team ID and User ID as filters, by [@mryanmurphy](https://github.com/mryanmurphy)
|
||||
* Weather module now supports a `useEmoji` setting, toggling the use of emoji characters in the title, by [@jonhadfield](https://github.com/jonhadfield)
|
||||
* Pocket documentation added, by [@3mard](https://github.com/3mard)
|
||||
|
||||
|
||||
### 🐞 Fixed
|
||||
|
||||
* GitLab Todo module now allows domain to be set, defaults to `https://gitlab.com`, by [@gerchardon](https://github.com/gerchardon)
|
||||
* Pi-hole module now works with Pi-hole v4 and v5, by [@jonhadfield](https://github.com/jonhadfield)
|
||||
* Null pointer exception fixed in VictorOps module, by [@ripienaar](https://github.com/ripienaar)
|
||||
|
||||
### 👍 Updated
|
||||
|
||||
* Updated `google.golang.org/api` from 0.25.0 to 0.29.0
|
||||
* Updated `pkg/profile` from 1.4.0 to 1.5.0
|
||||
* Updated `nicklaw5/helix` from 0.5.8 to 0.5.9
|
||||
* Updated `digitalocean/godo` from 1.37.0 to 1.38.0
|
||||
* Updated `gopkg.in/yaml.v2` from 2.2.8 to 2.3.0
|
||||
* Updated `xanzy/go-gitlab` from 0.31.0 to 0.33.0
|
||||
* Updated `stretchr/testify` from 1.5.1 to 1.6.1
|
||||
* Updated `golang.org/x/text` from 0.3.2 to 0.3.3
|
||||
* Updated `shirou/gopsutil` from 2.20.4+incompatible to 2.20.6+incompatible
|
||||
|
||||
## v0.30.0
|
||||
|
||||
### ⚡️ Added
|
||||
|
||||
* Expansive keyboard controls for the [GitLab](https://wtfutil.com/modules/gitlab/) module, by [@mogensen](https://github.com/mogensen)
|
||||
* [IPInfo](https://wtfutil.com/modules/ipaddress/ipinfo/) module now supports IPv6 lookup, by [@acaloiaro](https://github.com/acaloiaro)
|
||||
* The GitHub repo now runs a set of actions that lint PRs for code quality and conformity and comment in-line on the PRs. See here for action details https://github.com/wtfutil/wtf/actions
|
||||
|
||||
### 🐞 Fixed
|
||||
|
||||
* Random capital letters around display, [#811](https://github.com/wtfutil/wtf/issues/811) by [@jonhadfield](https://github.com/jonhadfield)
|
||||
* [Feed Reader](https://wtfutil.com/modules/feedreader/) module now properly sorts multi-feed items by date, by [@rsaarelm](https://github.com/rsaarelm)
|
||||
|
||||
### 👍 Updated
|
||||
|
||||
* Updated `zorkian/go-datadog-api` from 2.28.0+incompatible to 2.29.0+incompatible
|
||||
* Updated `shirou/gopsutil` from 2.20.3+incompatible to 2.20.4+incompatible
|
||||
* Updated `google.golang.org/api` from 0.22.0 to 0.23.0
|
||||
|
||||
## 0.29.0
|
||||
|
||||
### ⚡️ Added
|
||||
|
||||
* gCal module now has a `showEndTime` boolean option for displaying meeting end times, by [@acaloiaro](https://github.com/acaloiaro)
|
||||
* [Pi-hole](https://wtfutil.com/modules/pihole/) module added, by [@jonhadfield](https://github.com/jonhadfield)
|
||||
|
||||
### 🐞 Fixed
|
||||
|
||||
* Docker module subheading display, [#847](https://github.com/wtfutil/wtf/issues/847) by [@senorprogrammer](https://github.com/senorprogrammer)
|
||||
* Improved display of currencies for the Exchange Rate module, by [@indradhanush](https://github.com/indradhanush)
|
||||
|
||||
### 👍 Updated
|
||||
|
||||
* Updated `nicklaw5/helix` from 0.5.7 to 0.5.8
|
||||
* Updated `digitalocean/godo` from 1.34.0 to 1.35.1
|
||||
* Updated `xanzy/go-gitlab` from 0.28.0 to 0.31.0
|
||||
* Updated `shirou/gopsutil` from 2.20.2+incompatible to 2.20.3+incompatible
|
||||
* Updated `alecthomas/chroma` from 0.7.1 to 0.7.2
|
||||
* Updated `google.golang.org/api` from 0.21.0 to 0.22.0
|
||||
|
||||
## v0.28.0
|
||||
|
||||
### ⚡️ Added
|
||||
|
||||
* Support for customizing CPU, Mem, and Swap display in ResourceUsage, by [@leterio](https://github.com/leterio)
|
||||
|
||||
### 👍 Updated
|
||||
|
||||
* Now prefers Go 1.14 for compilation (should still work under 1.13 however)
|
||||
* Updated `shirou/gopsutil` from 2.20.1+incompatible to 2.20.2+incompatible
|
||||
* Updated `google.golang.org/api` from 0.17.0 to 0.20.0
|
||||
* Updated `digitalocean/godo` from 1.30.0 to 1.32.0
|
||||
* Updated `xanzy/go-gitlab` from 0.26.0 to 0.28.0
|
||||
* Updated `adlio/trello` from 1.6.0 to 1.7.0
|
||||
* Updated `zorkian/go-datadog-api` from 2.27.0+incompatible to 2.28.0+incompatible
|
||||
|
||||
## 0.27.0
|
||||
|
||||
### ⚡️ Added
|
||||
|
||||
* GitLab Todo module added, by [@elliotrushton](https://github.com/elliotrushton)
|
||||
* [CDS](https://wtfutil.com/modules/cds/) module added, by [@yesnault](https://github.com/yesnault)
|
||||
|
||||
### 🐞 Fixed
|
||||
|
||||
* The `vendor` directory has been removed, [#792](https://github.com/wtfutil/wtf/issues/792) by [@bjoernw](https://github.com/bjoernw)
|
||||
|
||||
### 👍 Updated
|
||||
|
||||
* Updated `zorkian/go-datadog-api` from 2.26.0+incompatible to 2.27.0+incompatible
|
||||
* Updated `google.golang.org/api` from 0.15.0 to 0.17.0
|
||||
* Updated `github.com/nicklaw5/helix` from 0.5.5 to 0.5.7
|
||||
* Updated `xanzy/go-gitlab` from 0.23.0 to 0.26.0
|
||||
* Updated `stretchr/testify` from o.4.0 to 0.5.1
|
||||
|
||||
## 0.26.0
|
||||
|
||||
### ⚡️ Added
|
||||
|
||||
* `myName` config setting added to PagerDuty module, by [@senorprogrammer](https://github.com/senorprogrammer)
|
||||
* `withDate` config setting added to Digital Clock module, by [@senorprogrammer](https://github.com/senorprogrammer)
|
||||
* Twitch module added, by [@bjoernw](https://github.com/bjoernw)
|
||||
* HackerNews module now opens HN comments when there is no alternative external link, [#758](https://github.com/wtfutil/wtf/issues/758) by [@senorprogrammer](https://github.com/senorprogrammer)
|
||||
* gCal module now now allows users to hide all-day events, [#733](https://github.com/wtfutil/wtf/issues/733) by [@senorprogrammer](https://github.com/senorprogrammer)
|
||||
* SpaceX module added, by [@bjoernw](https://github.com/bjoernw)
|
||||
* Support for obeying `XDG_CONFIG_HOME` when set, [#699](https://github.com/wtfutil/wtf/issues/699) by [@Seanstoppable](https://github.com/Seanstoppable)
|
||||
|
||||
### 🐞 Fixed
|
||||
|
||||
* Module templating working again, [#748](https://github.com/wtfutil/wtf/issues/748) by [@senorprogrammer](https://github.com/senorprogrammer)
|
||||
* CmdRunner title spacing issue fixed, [#784](https://github.com/wtfutil/wtf/issues/784) by [@senorprogrammer](https://github.com/senorprogrammer)
|
||||
* Colors in cmdrunner fixed when using nodejs chalk et al., [#618](https://github.com/wtfutil/wtf/issues/618) by [@Seanstoppable](https://github.com/Seanstoppable)
|
||||
* Docker buid instructions updated and improved, by [@firecat53](https://github.com/firecat53)
|
||||
* Kubernetes module can now be used with multiple contexts, [#809](https://github.com/wtfutil/wtf/issues/809) by [@davidsbond](https://github.com/davidsbond)
|
||||
|
||||
### 👍 Updated
|
||||
|
||||
* Updated `digitalocean/godo` from 1.22.0 to 1.30.0
|
||||
* Updated `google.golang.org/api` from 0.14.0 to 0.15.0
|
||||
* Updated `alecthomas/chroma` from 0.7.0 to 0.7.1
|
||||
* Updated `pkg/errors` from 0.8.1 to 0.9.1
|
||||
* Updated `xanzy/go-gitlab` from 0.22.2 to 0.23.0
|
||||
* Updated `shirou/gopsutil` from 2.19.11 to 2.20.1
|
||||
* Updated `zorkian/go-datadog-api` from 2.25.0 to 2.26.0
|
||||
* Updated `gopkg.in/yaml.v2` from 2.2.7 to 2.2.8
|
||||
* Updated `nicklaw5/helix` from 0.5.4 to 0.5.5
|
||||
|
||||
## 0.25.0
|
||||
|
||||
### ⚡️ Added
|
||||
|
||||
* [DigitalOcean](https://wtfutil.com/modules/digitalocean/) module added, by [@senorprogrammer](https://github.com/senorprogrammer)
|
||||
* [Transmission](https://wtfutil.com/modules/transmission/) module now supports a `hideComplete` configuration setting, by [@schoentoon](https://github.com/schoentoon)
|
||||
* Pocket module added, [#742] by [@3mard](https://github.com/3mard)
|
||||
* [Exchange Rates](https://wtfutil.com/modules/exchange_rates/) module added, by [@schoentoon](https://github.com/schoentoon)
|
||||
* [GitHub](https://wtfutil.com/modules/github/) modules supports 'p' keyboard command to open **p**ull requests, by [@NickyMateev](https://github.com/NickyMateev)
|
||||
* [GitHub](https://wtfutil.com/modules/github/) modules supports 'i' keyboard command to open **i**ssues, by [@NickyMateev](https://github.com/NickyMateev)
|
||||
* [Jenkins](https://wtfutil.com/modules/jenkins/) module now supports multi-configuration projects, by [@NickyMateev](https://github.com/NickyMateev)
|
||||
|
||||
### 🐞 Fixed
|
||||
|
||||
* Subreddit out of bounds error fixed, [#753](https://github.com/wtfutil/wtf/issues/753) by [@TDHTTTT](https://github.com/TDHTTTT)
|
||||
* Homebrew builds now contain version information, [#557](https://github.com/wtfutil/wtf/issues/557) by [@jottr](https://github.com/jottr)
|
||||
* CmdRunner flicker problem, [#732](https://github.com/wtfutil/wtf/issues/732) by [@Gibstick](https://github.com/Gibstick)
|
||||
|
||||
### 👍 Updated
|
||||
|
||||
* Switched from `gocenter.io` as the Go proxy to `proxy.golang.org`, by [@chenrui333](https://github.com/chenrui333)
|
||||
* Updated `go-datadog-api` to version 2.25.0+incompatible
|
||||
* Updated `adlio/trello` to version 1.6.0
|
||||
* Updated `alecthomas/chroma` to version 0.7.0
|
||||
* Updated `olekukonko/tablewriter` to version 0.0.3
|
||||
* Updated `pkg/profile` to version 1.4.0
|
||||
* Updated `yaml.v2` to 2.2.7
|
||||
* Updated `google.golang.org/api` to 0.14.0
|
||||
* Updated `xanzy/go-gitlab` to 0.22.2
|
||||
* Uodated `shirou/gopsutil` to 2.19.11+incompatible
|
||||
|
||||
|
||||
## v0.24.0
|
||||
|
||||
### ⚡️ Added
|
||||
|
||||
* Proper, usable [Docker file](https://github.com/wtfutil/wtf/blob/master/Dockerfile) added, by [@Boot-Error](https://github.com/Boot-Error)
|
||||
* [GitLab](https://wtfutil.com/modules/gitlab/) module displays issues assigned to, and opened by, the user, by [@caalberts](https://github.com/caalberts)
|
||||
* [TravisCI](https://wtfutil.com/modules/travisci/) now checks for uncommitted vendor changes, by [@indradhanush](https://github.com/indradhanush)
|
||||
* Football module added, by [@C123R](https://github.com/C123R)
|
||||
* [resourceuseage](https://wtfutil.com/modules/resourceusage/) now supports a `cpuCombined` setting, by [@madepolli](https://github.com/madepolli)
|
||||
* [Twitter Stats](https://wtfutil.com/modules/twitter/twittertweets/) module added, by [@Ameobea](https://github.com/Ameobea)
|
||||
|
||||
### 🐞 Fixed
|
||||
|
||||
* Github PRs do not count against issues, by [@alexfornuto](https://github.com/alexfornuto)
|
||||
* Todo scrolling now works properly, [#707](https://github.com/wtfutil/wtf/issues/707) by [3mard](https://github.com/3mard)
|
||||
* Configs with a missing `color` key now load properly, [#718](https://github.com/wtfutil/wtf/issues/718) and [#730](https://github.com/wtfutil/wtf/issues/730) by [@senorprogrammer](https://github.com/senorprogrammer)
|
||||
|
||||
## 0.23.0
|
||||
|
||||
### ⚡️ Added
|
||||
|
||||
* [Azure DevOps](https://wtfutil.com/modules/azure-devops/) module added, by [@v-braun](https://github.com/v-braun)
|
||||
* [Dev.to](https://wtfutil.com/modules/devto/) module added, by [@VictorAvelar](https://github.com/VictorAvelar)
|
||||
* [TravisCI]() module now supports enterprise endpoints, [#652](https://github.com/wtfutil/wtf/issues/652) by [@scw007](https://github.com/scw007)
|
||||
* [Subreddit](https://wtfutil.com/modules/subreddit/) module added, by [@lawrencecraft](https://github.com/lawrencecraft)
|
||||
* [gCal](https://wtfutil.com/modules/google/gcal/) module now supports a `hourFormat` setting for defining whether to display 12 or 24-hour times, [#665](https://github.com/wtfutil/wtf/issues/665) by [@senorprogrammer](https://github.com/senorprogrammer)
|
||||
* [Scarf](https://scarf.sh) installation instructions added to README, by [@aviaviavi](https://github.com/aviaviavi)
|
||||
* Spotify widget now supports colour themes, [#659](https://github.com/wtfutil/wtf/issues/659) by [@Tardog](https://github.com/Tardog)
|
||||
* [Buildkite](https://wtfutil.com/modules/buildkite/) module added, by [@jmks](https://github.com/jmks)
|
||||
* [Improvements](https://github.com/wtfutil/wtf/pull/680) to the [CmdRunner](https://wtfutil.com/modules/cmdrunner/) module, by [@noxer](https://github.com/noxer)
|
||||
|
||||
### 🐞 Fixed
|
||||
|
||||
* gCal calendar event time colour can now be changed by setting the `eventTime` configuration setting, [#638](https://github.com/wtfutil/wtf/issues/638) by [@indradhanush](https://github.com/indradhanush)
|
||||
* [Clocks](https://wtfutil.com/modules/clocks/) now obeys global row colour settings, [#658](https://github.com/wtfutil/wtf/issues/658) by [@senorprogrammer](https://github.com/senorprogrammer)
|
||||
* [Transmission](https://wtfutil.com/modules/transmission/) module no longer blocks rendering when a Transmission daemon cannot be found, [#661](https://github.com/wtfutil/wtf/issues/661) by [@senorprogrammer](https://github.com/senorprogrammer)
|
||||
* [Trello](https://wtfutil.com/modules/trello/) module now respects project list order, [#664](https://github.com/wtfutil/wtf/issues/664) by [@Seanstoppable](https://github.com/Seanstoppable)
|
||||
* [Todo](https://wtfutil.com/modules/todo/) module now respects checkbox settings, [#616](https://github.com/wtfutil/wtf/issues/616) by [@Seanstoppable](https://github.com/Seanstoppable)
|
||||
* [Todoist](https://wtfutil.com/modules/todoist/) module now properly handles todo items with due date and times, [#645](https://github.com/wtfutil/wtf/issues/645) by [@massa1240](https://github.com/massa1240)
|
||||
* Invalid pointer error in [Azure DevOps](https://wtfutil.com/modules/azure-devops/) fixed by [@Boot-Error](https://github.com/Boot-Error)
|
||||
* Renamed slice error in [Dev](https://wtfutil.com/modules/devto/) fixed by [@Boot-Error](https://github.com/Boot-Error)
|
||||
|
||||
### 👍 Updated
|
||||
|
||||
* Updated `go-datadog-api` to version v2.24.0
|
||||
* Updated `go-github` to version 26.13
|
||||
* Updated `watcher` to version 1.0.7
|
||||
* Updated `google-api-go-client` to version 0.10.0
|
||||
* Updated `chroma` to version 0.6.7
|
||||
* Updated `go-gitlab` to version 0.20.1
|
||||
* Updated `trello` to version 1.4.0
|
||||
* Updated `tcell` to version 1.3.0
|
||||
* Updated `gopsutil` to version 2.19.9+incompatible
|
||||
* Updated `yaml` to version 2.2.4
|
||||
|
||||
## v0.22.0
|
||||
|
||||
### ⚡️ Added
|
||||
|
||||
* [Arpansagovau](https://wtfutil.com/modules/weather_services/arpansagovau/) (arpansa.gov.au) module added, by [@jeffz](https://github.com/jeffz)
|
||||
* 'calendarReadLevel' setting added to gCal module, by [@mikkeljuhl](https://github.com/mikkeljuhl)
|
||||
* Todoist module now catches and displays API errors, by [@Seanstoppable](https://github.com/Seanstoppable)
|
||||
* TravisCI sort orders now configurable, by [@nyourchuck](https://github.com/nyourchuck)
|
||||
* Google Analytics module now supports real-time metrics, [#581](https://github.com/wtfutil/wtf/issues/581) by [@Ameobea](https://github.com/Ameobea)
|
||||
* Colors in configuration can now be defined using long-form hex, i.e.: #ff0000, by [@Seanstoppable](https://github.com/Seanstoppable)
|
||||
* GitHub module pull requests are now selectable and openable via keyboard, [#547](https://github.com/wtfutil/wtf/issues/547) by [@Midnight-Conqueror](https://github.com/Midnight-Conqueror)
|
||||
* [Docker](https://wtfutil.com/modules/docker/) module added, [#594](https://github.com/wtfutil/wtf/issues/594) by [@v-braun](https://github.com/v-braun)
|
||||
* NewRelic module now supports displaying data from multiple apps, [#471](https://github.com/wtfutil/wtf/issues/471) by [@ChrisDBrown](https://github.com/ChrisDBrown) and [@Seanstoppable](https://github.com/Seanstoppable)
|
||||
* [Digital Clock](https://wtfutil.com/modules/digitalclock/) module added, by [@Narengowda](https://github.com/Narengowda)
|
||||
|
||||
### 🐞 Fixed
|
||||
|
||||
* ScrollableWidget bounds checking error fixed, [#578](https://github.com/wtfutil/wtf/issues/578) by [@Seanstoppable](https://github.com/Seanstoppable)
|
||||
* Now properly URL-decodes Jenkins branch names, [#575](https://github.com/wtfutil/wtf/issues/575) by [@lesteenman](https://github.com/lesteenman)
|
||||
* Jira column sizes render properly, [#574](https://github.com/wtfutil/wtf/issues/574) by [@lesteenman](https://github.com/lesteenman)
|
||||
* Todoist module updated to latest API version, by [@Seanstoppable](https://github.com/Seanstoppable)
|
||||
* gCal colour highlighting working again, [#611](https://github.com/wtfutil/wtf/issues/611) by [@senorprogrammer](https://github.com/senorprogrammer)
|
||||
* Per-module background and text colour settings working again, [#568](https://github.com/wtfutil/wtf/issues/568) by [@Seanstoppable](https://github.com/Seanstoppable)
|
||||
* Git module no longer forces sorting of repositories, [#608](https://github.com/wtfutil/wtf/pull/608) by [@Seanstoppable](https://github.com/Seanstoppable)
|
||||
* GitHub PR icons render properly without phantom characters, by [@Midnight-Conqueror](https://github.com/Midnight-Conqueror)
|
||||
* GitLab configuration now takes a list of project paths, [#566](https://github.com/wtfutil/wtf/issues/566) by [@senorprogrammer](https://github.com/senorprogrammer)
|
||||
* Kubernetes configuration segfault fixed, [#549](https://github.com/wtfutil/wtf/issues/549) by [@ibaum](https://github.com/ibaum)
|
||||
|
||||
## v0.21.0
|
||||
|
||||
### ⚡️ Added
|
||||
|
||||
* Power Soure module support added for FreeBSD, by [@hxw](https://github.com/hxw)
|
||||
|
||||
### 🐞 Fixed
|
||||
|
||||
* Power indicator displays ∞ on Linux when fully-charged and on AC power, [#534](https://github.com/wtfutil/wtf/issues/534) by [@Seanstoppable](https://github.com/Seanstoppable)
|
||||
* Default background color is now the terminal background color, making transparency support possible in MacOS and Linux, by [@Seanstoppable](https://github.com/Seanstoppable)
|
||||
* `xdg-open` now used as the opener for HTTP/HTTPS by default, by [@hxw](https://github.com/hxw)
|
||||
* Transmission port over-ride now working, [#565](https://github.com/wtfutil/wtf/issues/565) by [@Seanstoppable](https://github.com/Seanstoppable)
|
||||
* Default config is now created on first run, [#553](https://github.com/wtfutil/wtf/issues/553) by [@senorprogrammer](https://github.com/senorprogrammer)
|
||||
|
||||
## v0.20.0
|
||||
|
||||
### ⚡️ Added
|
||||
|
||||
* Kubernetes module added, [#142](https://github.com/wtfutil/wtf/issues/142) by [@sudermanjr](https://github.com/sudermanjr)
|
||||
|
||||
### 🐞 Fixed
|
||||
|
||||
* Tab and Esc keys work properly in modal dialogs, [#520](https://github.com/wtfutil/wtf/issues/520) by [@Seanstoppable](https://github.com/Seanstoppable)
|
||||
* `wtfutil -m` flag now works with non-enabled modules, [#529](https://github.com/wtfutil/wtf/issues/529) by [@Seanstoppable](https://github.com/Seanstoppable)
|
||||
* Jenkins job filtering preserved across redraws, [#532](https://github.com/wtfutil/wtf/issues/532) by [@Seanstoppable](https://github.com/Seanstoppable)
|
||||
|
||||
## v0.19.1
|
||||
|
||||
### ⚡️ Added
|
||||
|
||||
* Dockerfile, by [@senorprogrammer](https://github.com/senorprogrammer)
|
||||
* Add build targets for arm and arm64 architectures, by [@senorprogrammer](https://github.com/senorprogrammer)
|
||||
|
||||
## v0.19.0
|
||||
|
||||
### ☠️ Breaking Change
|
||||
|
||||
* HIBP module now requires an API key to operate. See [Authentication and the Have I Been Pwned API](https://www.troyhunt.com/authentication-and-the-have-i-been-pwned-api/) for more details, [#508](https://github.com/wtfutil/wtf/issues/508) by [@senorprogrammer](https://github.com/senorprogrammer)
|
||||
|
||||
### ⚡️ Added
|
||||
|
||||
* OpsGenie module now supports "region" configuration option ("us" or "eu"), by [@l13t](https://github.com/l13t)
|
||||
|
||||
### 🐞 Fixed
|
||||
|
||||
* Fixes the error message shown when an explicitly-specified custom config file cannot be found or cannot be read, by [@senorprogrammer](https://github.com/senorprogrammer)
|
||||
* Rollbar module works again, [#507](https://github.com/wtfutil/wtf/issues/507) by [@Seanstoppable](https://github.com/Seanstoppable)
|
||||
* The default config that gets installed on first run is much improved, [#504](https://github.com/wtfutil/wtf/issues/504) by [@senorprogrammer](https://github.com/senorprogrammer)
|
||||
* Default config file is now `chmod 0600` to ensure only the owning user can read it, by [@senorprogrammer](https://github.com/senorprogrammer)
|
||||
|
||||
## v0.18.0
|
||||
|
||||
### ⚡️ Added
|
||||
|
||||
* Google Analytics module, by [@DylanBartels](https://github.com/DylanBartels)
|
||||
|
||||
### 🐞 Fixed
|
||||
|
||||
* Now created ~/.config if that directory is missing, [#510](https://github.com/wtfutil/wtf/issues/510) by [@senorprogrammer](https://github.com/senorprogrammer)
|
||||
|
||||
## v0.17.1
|
||||
|
||||
### 🐞 Fixed
|
||||
|
||||
* Fixes an issue in which the default config file was not being created on first run
|
||||
|
||||
## v0.17.0
|
||||
|
||||
### 🐞 Fixed
|
||||
|
||||
* FeedReader story sorting bug fixed
|
||||
* NewRelic dependency vendored
|
||||
|
||||
## v0.16.1
|
||||
## v0.16.0
|
||||
|
||||
### ⚡️ Added
|
||||
|
||||
* Config and recipe added for installing via Homebrew
|
||||
|
||||
## v0.15.0
|
||||
|
||||
### ❗️Changed
|
||||
|
||||
* The installed binary has been renamed from `wtf` to `wtfutil`. [Read more about it here](https://wtfutil.com/blog/2019-07-10-wtfutil-release/).
|
||||
|
||||
## v0.14.0
|
||||
|
||||
### ⚡️ Added
|
||||
|
||||
* CmdRunner module now supports custom titles, by [@Seanstoppable](https://github.com/Seanstoppable)
|
||||
* FeedReader module added (https://wtfutil.com/modules/feedreader/), a rudimentary Rss & Atom feed reader
|
||||
|
||||
### 🐞 Fixed
|
||||
|
||||
* Cryptolive module works again, [#481](https://github.com/wtfutil/wtf/issues/481) by [@Seanstoppable](https://github.com/Seanstoppable)
|
||||
* gCal module now supports setting an explicit time zone via the "timezone" config attribute, [#382](https://github.com/wtfutil/wtf/issues/382) by [@jeangovil](https://github.com/jeangovil)
|
||||
* Misconfigured module positions in `config.yaml` now attempt to provide informative error messages on launch, [#482](https://github.com/wtfutil/wtf/issues/482)
|
||||
|
||||
## v0.13.0
|
||||
|
||||
### ⚡️ Added
|
||||
|
||||
* Transmission module addedd (https://wtfutil.com/modules/transmission/)
|
||||
|
||||
## v0.12.0
|
||||
|
||||
### ⚡️ Added
|
||||
@ -22,6 +484,8 @@
|
||||
|
||||
## v0.10.3
|
||||
|
||||
### ❗️Changed
|
||||
|
||||
* Invalid glog dependency removed, by [@bosr](https://github.com/bosr)
|
||||
|
||||
## v0.10.2
|
||||
@ -74,7 +538,7 @@
|
||||
|
||||
### ⚡️ Added
|
||||
|
||||
* Dependencies are now managed and installed using Go modules. See README.md for details, [#406](https://github.com/wtfutil/wtf/issues/406) by [@retgits](https://github.com/retgits)
|
||||
* Dependencies are now managed and installed using Go modules. See README.md for details, [#406](https://github.com/wtfutil/wtf/issues/406) by [@retgits](https://github.com/retgits)
|
||||
|
||||
## 0.7.2
|
||||
|
||||
@ -123,7 +587,7 @@
|
||||
### ⚡️ Added
|
||||
|
||||
* Resource Usage module added by [@nicholas-eden](https://github.com/nicholas-eden)
|
||||
* Recursive repo search in Git module ([#126](https://github.com/wtfutil/wtf/issues/126) by [@anandsudhir](http://github.com/anandsudhir))
|
||||
* Recursive repo search in Git module ([#126](https://github.com/wtfutil/wtf/issues/126) by [@anandsudhir](http://github.com/anandsudhir))
|
||||
* HTTP/HTTPS handling in OpenFile() util function by [@jdenoy](https://github.com/jdenoy)
|
||||
* Honor system http proxies when using non-default transport by [@skymeyer](https://github.com/skymeyer)
|
||||
* VictorOps module added by [ImDevinC](https://github.com/ImDevinC)
|
||||
|
@ -1,16 +1,12 @@
|
||||
# Contributing
|
||||
|
||||
When contributing to this repository, please first discuss the change you wish to make via issue,
|
||||
email, or any other method with the owners of this repository before making a change.
|
||||
|
||||
Note that we have a code of conduct. Please follow it in all your interactions with the project.
|
||||
|
||||
## Pull Request Process
|
||||
|
||||
1. Ensure any install or build dependencies are removed before the end of the layer when doing a
|
||||
build.
|
||||
2. Update the static documentation with details of changes to the interface, this includes new environment
|
||||
variables, useful file locations and configuration parameters.
|
||||
|
||||
Documentation lives at [wtfdocs](https://github.com/wtfutil/wtfdocs) and is a [Hugo](https://gohugo.io) app. See Hugo's documentation for usage.
|
||||
|
||||
## Code of Conduct
|
||||
|
26
Dockerfile
Normal file
26
Dockerfile
Normal file
@ -0,0 +1,26 @@
|
||||
FROM golang:1.16-alpine as build
|
||||
|
||||
ARG version=master
|
||||
|
||||
RUN apk add git make ncurses && \
|
||||
git clone https://github.com/wtfutil/wtf.git $GOPATH/src/github.com/wtfutil/wtf && \
|
||||
cd $GOPATH/src/github.com/wtfutil/wtf && \
|
||||
git checkout $version
|
||||
|
||||
ENV GOPROXY=https://proxy.golang.org,direct
|
||||
ENV GO111MODULE=on
|
||||
ENV GOSUMDB=off
|
||||
|
||||
WORKDIR $GOPATH/src/github.com/wtfutil/wtf
|
||||
|
||||
ENV PATH=$PATH:./bin
|
||||
|
||||
RUN make build
|
||||
|
||||
FROM alpine
|
||||
|
||||
COPY --from=build /go/src/github.com/wtfutil/wtf/bin/wtfutil /usr/local/bin/
|
||||
RUN adduser -h /config -DG users -u 20000 wtf
|
||||
|
||||
USER wtf
|
||||
ENTRYPOINT ["wtfutil"]
|
18
Dockerfile.build
Normal file
18
Dockerfile.build
Normal file
@ -0,0 +1,18 @@
|
||||
FROM golang:1.16 as build
|
||||
|
||||
ARG version=master
|
||||
|
||||
RUN git clone https://github.com/wtfutil/wtf.git $GOPATH/src/github.com/wtfutil/wtf && \
|
||||
cd $GOPATH/src/github.com/wtfutil/wtf && \
|
||||
git checkout $version
|
||||
|
||||
ENV GOPROXY=https://proxy.golang.org,direct
|
||||
ENV GO111MODULE=on
|
||||
ENV GOSUMDB=off
|
||||
|
||||
WORKDIR $GOPATH/src/github.com/wtfutil/wtf
|
||||
|
||||
ENV PATH=$PATH:./bin
|
||||
|
||||
RUN make build && \
|
||||
cp bin/wtfutil /usr/local/bin/
|
54
LICENSE.md
54
LICENSE.md
@ -1,6 +1,8 @@
|
||||
Copyright 2018, Chris Cummer
|
||||
*Mozilla Public License, version 2.0*
|
||||
|
||||
Mozilla Public License, version 2.0 1. Definitions 1.1. “Contributor” means each individual or legal entity that creates, contributes to the creation of, or owns Covered Software.
|
||||
1. Definitions
|
||||
|
||||
1.1. “Contributor” means each individual or legal entity that creates, contributes to the creation of, or owns Covered Software.
|
||||
|
||||
1.2. “Contributor Version” means the combination of the Contributions of others (if any) used by a Contributor and that particular Contributor’s Contribution.
|
||||
|
||||
@ -24,9 +26,9 @@ that the Covered Software was made available under the terms of version 1.1 or e
|
||||
|
||||
1.10. “Modifications” means any of the following:
|
||||
|
||||
any file in Source Code Form that results from an addition to, deletion from, or modification of the contents of Covered Software; or
|
||||
any file in Source Code Form that results from an addition to, deletion from, or modification of the contents of Covered Software; or
|
||||
|
||||
any new file in Source Code Form that contains any Covered Software.
|
||||
any new file in Source Code Form that contains any Covered Software.
|
||||
|
||||
1.11. “Patent Claims” of a Contributor means any patent claim(s), including without limitation, method, process, and apparatus claims, in any patent Licensable by such Contributor that would be infringed, but for the grant of the License, by the making, using, selling, offering for sale, having made, import, or transfer of either its Contributions or its Contributor Version.
|
||||
|
||||
@ -36,7 +38,9 @@ any new file in Source Code Form that contains any Covered Software.
|
||||
|
||||
1.14. “You” (or “Your”) means an individual or a legal entity exercising rights under this License. For legal entities, “You” includes any entity that controls, is controlled by, or is under common control with You. For purposes of this definition, “control” means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity.
|
||||
|
||||
2. License Grants and Conditions 2.1. Grants Each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license:
|
||||
2. License Grants and Conditions
|
||||
|
||||
2.1. Grants Each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license:
|
||||
|
||||
under intellectual property rights (other than patent or trademark) Licensable by such Contributor to use, reproduce, make available, modify, display, perform, distribute, and otherwise exploit its Contributions, either on an unmodified basis, with Modifications, or as part of a Larger Work; and
|
||||
|
||||
@ -62,7 +66,9 @@ This License does not grant any rights in the trademarks, service marks, or logo
|
||||
|
||||
2.7. Conditions Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in Section 2.1.
|
||||
|
||||
3. Responsibilities 3.1. Distribution of Source Form All distribution of Covered Software in Source Code Form, including any Modifications that You create or to which You contribute, must be under the terms of this License. You must inform recipients that the Source Code Form of the Covered Software is governed by the terms of this License, and how they can obtain a copy of this License. You may not attempt to alter or restrict the recipients’ rights in the Source Code Form.
|
||||
3. Responsibilities
|
||||
|
||||
3.1. Distribution of Source Form All distribution of Covered Software in Source Code Form, including any Modifications that You create or to which You contribute, must be under the terms of this License. You must inform recipients that the Source Code Form of the Covered Software is governed by the terms of this License, and how they can obtain a copy of this License. You may not attempt to alter or restrict the recipients’ rights in the Source Code Form.
|
||||
|
||||
3.2. Distribution of Executable Form If You distribute Covered Software in Executable Form then:
|
||||
|
||||
@ -76,23 +82,37 @@ You may distribute such Executable Form under the terms of this License, or subl
|
||||
|
||||
3.5. Application of Additional Terms You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Software. However, You may do so only on Your own behalf, and not on behalf of any Contributor. You must make it absolutely clear that any such warranty, support, indemnity, or liability obligation is offered by You alone, and You hereby agree to indemnify every Contributor for any liability incurred by such Contributor as a result of warranty, support, indemnity or liability terms You offer. You may include additional disclaimers of warranty and limitations of liability specific to any jurisdiction.
|
||||
|
||||
4. Inability to Comply Due to Statute or Regulation If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Software due to statute, judicial order, or regulation then You must: (a) comply with the terms of this License to the maximum extent possible; and (b) describe the limitations and the code they affect. Such description must be placed in a text file included with all distributions of the Covered Software under this License. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it.
|
||||
4. Inability to Comply Due to Statute or Regulation
|
||||
|
||||
5. Termination 5.1. The rights granted under this License will terminate automatically if You fail to comply with any of its terms. However, if You become compliant, then the rights granted under this License from a particular Contributor are reinstated (a) provisionally, unless and until such Contributor explicitly and finally terminates Your grants, and (b) on an ongoing basis, if such Contributor fails to notify You of the non-compliance by some reasonable means prior to 60 days after You have come back into compliance. Moreover, Your grants from a particular Contributor are reinstated on an ongoing basis if such Contributor notifies You of the non-compliance by some reasonable means, this is the first time You have received notice of non-compliance with this License from such Contributor, and You become compliant prior to 30 days after Your receipt of the notice.
|
||||
If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Software due to statute, judicial order, or regulation then You must: (a) comply with the terms of this License to the maximum extent possible; and (b) describe the limitations and the code they affect. Such description must be placed in a text file included with all distributions of the Covered Software under this License. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it.
|
||||
|
||||
5. Termination
|
||||
|
||||
5.1. The rights granted under this License will terminate automatically if You fail to comply with any of its terms. However, if You become compliant, then the rights granted under this License from a particular Contributor are reinstated (a) provisionally, unless and until such Contributor explicitly and finally terminates Your grants, and (b) on an ongoing basis, if such Contributor fails to notify You of the non-compliance by some reasonable means prior to 60 days after You have come back into compliance. Moreover, Your grants from a particular Contributor are reinstated on an ongoing basis if such Contributor notifies You of the non-compliance by some reasonable means, this is the first time You have received notice of non-compliance with this License from such Contributor, and You become compliant prior to 30 days after Your receipt of the notice.
|
||||
|
||||
5.2. If You initiate litigation against any entity by asserting a patent infringement claim (excluding declaratory judgment actions, counter-claims, and cross-claims) alleging that a Contributor Version directly or indirectly infringes any patent, then the rights granted to You by any and all Contributors for the Covered Software under Section 2.1 of this License shall terminate.
|
||||
|
||||
5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user license agreements (excluding distributors and resellers) which have been validly granted by You or Your distributors under this License prior to termination shall survive termination.
|
||||
|
||||
6. Disclaimer of Warranty Covered Software is provided under this License on an “as is” basis, without warranty of any kind, either expressed, implied, or statutory, including, without limitation, warranties that the Covered Software is free of defects, merchantable, fit for a particular purpose or non-infringing. The entire risk as to the quality and performance of the Covered Software is with You. Should any Covered Software prove defective in any respect, You (not any Contributor) assume the cost of any necessary servicing, repair, or correction. This disclaimer of warranty constitutes an essential part of this License. No use of any Covered Software is authorized under this License except under this disclaimer.
|
||||
6. Disclaimer of Warranty
|
||||
|
||||
7. Limitation of Liability Under no circumstances and under no legal theory, whether tort (including negligence), contract, or otherwise, shall any Contributor, or anyone who distributes Covered Software as permitted above, be liable to You for any direct, indirect, special, incidental, or consequential damages of any character including, without limitation, damages for lost profits, loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses, even if such party shall have been informed of the possibility of such damages. This limitation of liability shall not apply to liability for death or personal injury resulting from such party’s negligence to the extent applicable law prohibits such limitation. Some jurisdictions do not allow the exclusion or limitation of incidental or consequential damages, so this exclusion and limitation may not apply to You.
|
||||
Covered Software is provided under this License on an “as is” basis, without warranty of any kind, either expressed, implied, or statutory, including, without limitation, warranties that the Covered Software is free of defects, merchantable, fit for a particular purpose or non-infringing. The entire risk as to the quality and performance of the Covered Software is with You. Should any Covered Software prove defective in any respect, You (not any Contributor) assume the cost of any necessary servicing, repair, or correction. This disclaimer of warranty constitutes an essential part of this License. No use of any Covered Software is authorized under this License except under this disclaimer.
|
||||
|
||||
8. Litigation Any litigation relating to this License may be brought only in the courts of a jurisdiction where the defendant maintains its principal place of business and such litigation shall be governed by laws of that jurisdiction, without reference to its conflict-of-law provisions. Nothing in this Section shall prevent a party’s ability to bring cross-claims or counter-claims.
|
||||
7. Limitation of Liability
|
||||
|
||||
9. Miscellaneous This License represents the complete agreement concerning the subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not be used to construe this License against a Contributor.
|
||||
Under no circumstances and under no legal theory, whether tort (including negligence), contract, or otherwise, shall any Contributor, or anyone who distributes Covered Software as permitted above, be liable to You for any direct, indirect, special, incidental, or consequential damages of any character including, without limitation, damages for lost profits, loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses, even if such party shall have been informed of the possibility of such damages. This limitation of liability shall not apply to liability for death or personal injury resulting from such party’s negligence to the extent applicable law prohibits such limitation. Some jurisdictions do not allow the exclusion or limitation of incidental or consequential damages, so this exclusion and limitation may not apply to You.
|
||||
|
||||
10. Versions of the License 10.1. New Versions Mozilla Foundation is the license steward. Except as provided in Section 10.3, no one other than the license steward has the right to modify or publish new versions of this License. Each version will be given a distinguishing version number.
|
||||
8. Litigation
|
||||
|
||||
Any litigation relating to this License may be brought only in the courts of a jurisdiction where the defendant maintains its principal place of business and such litigation shall be governed by laws of that jurisdiction, without reference to its conflict-of-law provisions. Nothing in this Section shall prevent a party’s ability to bring cross-claims or counter-claims.
|
||||
|
||||
9. Miscellaneous
|
||||
|
||||
This License represents the complete agreement concerning the subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not be used to construe this License against a Contributor.
|
||||
|
||||
10. Versions of the License
|
||||
|
||||
10.1. New Versions Mozilla Foundation is the license steward. Except as provided in Section 10.3, no one other than the license steward has the right to modify or publish new versions of this License. Each version will be given a distinguishing version number.
|
||||
|
||||
10.2. Effect of New Versions You may distribute the Covered Software under the terms of the version of the License under which You originally received the Covered Software, or under the terms of any subsequent version published by the license steward.
|
||||
|
||||
@ -100,10 +120,14 @@ You may distribute such Executable Form under the terms of this License, or subl
|
||||
|
||||
10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses If You choose to distribute Source Code Form that is Incompatible With Secondary Licenses under the terms of this version of the License, the notice described in Exhibit B of this License must be attached.
|
||||
|
||||
Exhibit A - Source Code Form License Notice This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
Exhibit A - Source Code Form License Notice
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
If it is not possible or desirable to put the notice in a particular file, then You may include the notice in a location (such as a LICENSE file in a relevant directory) where a recipient would be likely to look for such a notice.
|
||||
|
||||
You may add additional accurate notices of copyright ownership.
|
||||
|
||||
Exhibit B - “Incompatible With Secondary Licenses” Notice This Source Code Form is “Incompatible With Secondary Licenses”, as defined by the Mozilla Public License, v. 2.0.
|
||||
Exhibit B - “Incompatible With Secondary Licenses” Notice
|
||||
|
||||
This Source Code Form is “Incompatible With Secondary Licenses”, as defined by the Mozilla Public License, v. 2.0.
|
||||
|
165
Makefile
165
Makefile
@ -1,45 +1,164 @@
|
||||
.PHONY: contrib_check dependencies install run size test
|
||||
.PHONY: build clean contrib_check coverage docker-build docker-install help install isntall lint run size test uninstall
|
||||
|
||||
# detect GOPATH if not set
|
||||
ifndef $(GOPATH)
|
||||
$(info GOPATH is not set, autodetecting..)
|
||||
TESTPATH := $(dir $(abspath ../../..))
|
||||
DIRS := bin pkg src
|
||||
# create a ; separated line of tests and pass it to shell
|
||||
MISSING_DIRS := $(shell $(foreach entry,$(DIRS),test -d "$(TESTPATH)$(entry)" || echo "$(entry)";))
|
||||
ifeq ($(MISSING_DIRS),)
|
||||
$(info Found GOPATH: $(TESTPATH))
|
||||
export GOPATH := $(TESTPATH)
|
||||
else
|
||||
$(info ..missing dirs "$(MISSING_DIRS)" in "$(TESTDIR)")
|
||||
$(info GOPATH autodetection failed)
|
||||
endif
|
||||
$(info GOPATH is not set, autodetecting..)
|
||||
TESTPATH := $(dir $(abspath ../../..))
|
||||
DIRS := bin pkg src
|
||||
|
||||
# create a ; separated line of tests and pass it to shell
|
||||
MISSING_DIRS := $(shell $(foreach entry,$(DIRS),test -d "$(TESTPATH)$(entry)" || echo "$(entry)";))
|
||||
ifeq ($(MISSING_DIRS),)
|
||||
$(info Found GOPATH: $(TESTPATH))
|
||||
export GOPATH := $(TESTPATH)
|
||||
else
|
||||
$(info ..missing dirs "$(MISSING_DIRS)" in "$(TESTDIR)")
|
||||
$(info GOPATH autodetection failed)
|
||||
endif
|
||||
endif
|
||||
|
||||
# Set go modules to on and use GoCenter for immutable modules
|
||||
export GO111MODULE = on
|
||||
export GOPROXY = https://gocenter.io
|
||||
export GOPROXY = https://proxy.golang.org,direct
|
||||
|
||||
# Determines the path to this Makefile
|
||||
THIS_FILE := $(lastword $(MAKEFILE_LIST))
|
||||
|
||||
APP=wtfutil
|
||||
|
||||
define HEADER
|
||||
____ __ ____ .___________. _______
|
||||
\ \ / \ / / | || ____|
|
||||
\ \/ \/ / `---| |----`| |__
|
||||
\ / | | | __|
|
||||
\ /\ / | | | |
|
||||
\__/ \__/ |__| |__|
|
||||
|
||||
endef
|
||||
export HEADER
|
||||
|
||||
# -------------------- Actions -------------------- #
|
||||
|
||||
## build: builds a local version
|
||||
build:
|
||||
go build -o bin/wtf
|
||||
@echo "$$HEADER"
|
||||
@echo "Building..."
|
||||
go build -o bin/${APP}
|
||||
@echo "Done building"
|
||||
|
||||
contrib_check:
|
||||
## clean: removes old build cruft
|
||||
clean:
|
||||
rm -rf ./dist
|
||||
rm -rf ./bin/${APP}
|
||||
@echo "Done cleaning"
|
||||
|
||||
## contrib-check: checks for any contributors who have not been given due credit
|
||||
contrib-check:
|
||||
npx all-contributors-cli check
|
||||
|
||||
## coverage: figures out and displays test code coverage
|
||||
coverage:
|
||||
go test -coverprofile=coverage.out ./...
|
||||
go tool cover -html=coverage.out
|
||||
|
||||
## docker-build: builds in docker
|
||||
docker-build:
|
||||
@echo "Building ${APP} in Docker..."
|
||||
docker build -t wtfutil:build --build-arg=version=master -f Dockerfile.build .
|
||||
@echo "Done with docker build"
|
||||
|
||||
## docker-install: installs a local version of the app from docker build
|
||||
docker-install:
|
||||
@echo "Installing..."
|
||||
docker create --name wtf_build wtfutil:build
|
||||
docker cp wtf_build:/usr/local/bin/wtfutil ~/.local/bin/
|
||||
$(eval INSTALLPATH = $(shell which ${APP}))
|
||||
@echo "${APP} installed into ${INSTALLPATH}"
|
||||
docker rm wtf_build
|
||||
|
||||
## gosec: runs the gosec static security scanner against the source code
|
||||
gosec:
|
||||
gosec -tests ./...
|
||||
|
||||
## help: prints this help message
|
||||
help:
|
||||
@echo "Usage: \n"
|
||||
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'
|
||||
|
||||
## isntall: an alias for 'install'
|
||||
isntall:
|
||||
@$(MAKE) -f $(THIS_FILE) install
|
||||
|
||||
## install: installs a local version of the app
|
||||
install:
|
||||
$(eval GOVERS = $(shell go version))
|
||||
@echo "$$HEADER"
|
||||
@echo "Installing ${APP} with ${GOVERS}..."
|
||||
@go clean
|
||||
@go install -ldflags="-s -w -X main.version=$(shell git describe --always --abbrev=6) -X main.date=$(shell date +%FT%T%z)"
|
||||
@which wtf || echo "Could not find wtf in PATH" && exit 0
|
||||
@mv ~/go/bin/wtf ~/go/bin/${APP}
|
||||
$(eval INSTALLPATH = $(shell which ${APP}))
|
||||
@echo "${APP} installed into ${INSTALLPATH}"
|
||||
|
||||
## lint: runs a number of code quality checks against the source code
|
||||
lint:
|
||||
structcheck ./...
|
||||
varcheck ./...
|
||||
golangci-lint cache clean
|
||||
golangci-lint run
|
||||
|
||||
# lint:
|
||||
# @echo "\033[35mhttps://github.com/kisielk/errcheck\033[0m"
|
||||
# errcheck ./app
|
||||
# errcheck ./cfg
|
||||
# errcheck ./flags
|
||||
# errcheck ./help
|
||||
# errcheck ./logger
|
||||
# errcheck ./modules/...
|
||||
# errcheck ./utils
|
||||
# errcheck ./view
|
||||
# errcheck ./wtf
|
||||
# errcheck ./main.go
|
||||
|
||||
# @echo "\033[35mhttps://golang.org/cmd/vet/k\033[0m"
|
||||
# go vet ./app
|
||||
# go vet ./cfg
|
||||
# go vet ./flags
|
||||
# go vet ./help
|
||||
# go vet ./logger
|
||||
# go vet ./modules/...
|
||||
# go vet ./utils
|
||||
# go vet ./view
|
||||
# go vet ./wtf
|
||||
# go vet ./main.go
|
||||
|
||||
# @echo "\033[35m# https://staticcheck.io/docs/k\033[0m"
|
||||
# staticcheck ./app
|
||||
# staticcheck ./cfg
|
||||
# staticcheck ./flags
|
||||
# staticcheck ./help
|
||||
# staticcheck ./logger
|
||||
# staticcheck ./modules/...
|
||||
# staticcheck ./utils
|
||||
# staticcheck ./view
|
||||
# staticcheck ./wtf
|
||||
# staticcheck ./main.go
|
||||
|
||||
# @echo "\033[35m# https://github.com/mdempsky/unconvert\033[0m"
|
||||
# unconvert ./...
|
||||
|
||||
## loc: displays the lines of code (LoC) count
|
||||
loc:
|
||||
@loc --exclude _sample_configs/ _site/ docs/ Makefile *.md
|
||||
|
||||
## run: executes the locally-installed version
|
||||
run: build
|
||||
bin/wtf
|
||||
|
||||
size:
|
||||
loc --exclude _sample_configs/ _site/ docs/ Makefile *.md
|
||||
@echo "$$HEADER"
|
||||
bin/${APP}
|
||||
|
||||
## test: runs the test suite
|
||||
test: build
|
||||
@echo "$$HEADER"
|
||||
go test ./...
|
||||
|
||||
## uninstall: uninstals a locally-installed version
|
||||
uninstall:
|
||||
@rm ~/go/bin/${APP}
|
||||
|
472
README.md
472
README.md
@ -1,33 +1,164 @@
|
||||
<p align="center">
|
||||
<img src="./images/logo_transparent.png?raw=true" title="WTF" alt="WTF" width="560" height="560" />
|
||||
</p>
|
||||
|
||||
[](#contributors)
|
||||
[](https://travis-ci.com/wtfutil/wtf)
|
||||
[](https://gitter.im/wtfutil/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
[](https://twitter.com/wtfutil)
|
||||
[](https://goreportcard.com/report/github.com/wtfutil/wtf)
|
||||
<p align="center">
|
||||
<a href="#contributors"><img alt="All Contributors" src="https://img.shields.io/badge/all_contributors-114-orange.svg?style=flat-square"></a>
|
||||
<a href="https://travis-ci.com/wtfutil/wtf"><img alt="Travis Status" src="https://img.shields.io/travis/com/wtfutil/wtf/master.svg?label=travis&maxAge=43200"></a>
|
||||
<a href="https://goreportcard.com/report/github.com/wtfutil/wtf"><img alt="Go Report Card" src="https://goreportcard.com/badge/github.com/wtfutil/wtf"></a>
|
||||
<a href="https://twitter.com/wtfutil"><img alt="Twitter" src="https://img.shields.io/badge/follow-on%20twitter-blue.svg"></a>
|
||||
</p>
|
||||
|
||||
# WTF
|
||||
WTF (aka 'wtfutil') is the personal information dashboard for your terminal, providing at-a-glance access to your very important but infrequently-needed stats and data.
|
||||
|
||||
A personal terminal-based dashboard utility, designed for
|
||||
displaying infrequently-needed, but very important, daily data.
|
||||
Used by thousands of developers and tech people around the world, WTF is free and open-source. To support the continued use and development of WTF, please consider sponsoring WTF via [GitHub Sponsors](https://github.com/sponsors/senorprogrammer).
|
||||
|
||||
* [Screenshot](https://github.com/wtfutil/wtf/blob/master/README.md#screenshot)
|
||||
* [Communication](https://github.com/wtfutil/wtf/blob/master/README.md#communication)
|
||||
* [Slack](https://github.com/wtfutil/wtf/blob/master/README.md#slack)
|
||||
* [Twitter](https://github.com/wtfutil/wtf/blob/master/README.md#twitter)
|
||||
* [Quick Start](https://github.com/wtfutil/wtf/blob/master/README.md#quick-start)
|
||||
* [Documentation](https://github.com/wtfutil/wtf/blob/master/README.md#documentation)
|
||||
* [Contributing to the Documentation](https://github.com/wtfutil/wtf/blob/master/README.md#contributing-to-the-documentation)
|
||||
* [Contributing to the Source Code](https://github.com/wtfutil/wtf/blob/master/README.md#contributing-to-the-source-code)
|
||||
* [Adding Dependencies](https://github.com/wtfutil/wtf/blob/master/README.md#adding-dependencies)
|
||||
* [Contributors](https://github.com/wtfutil/wtf/blob/master/README.md#contributors)
|
||||
* [Acknowledgements](https://github.com/wtfutil/wtf/blob/master/README.md#acknowledgments)
|
||||
### Are you a contributor or sponsor?
|
||||
|
||||
## Screenshot
|
||||
Awesome! [See here](https://wtfutil.com/#exit-message) for how you can change the exit message, the message WTF shows when quitting, to something special just for you.
|
||||
|
||||
#
|
||||
|
||||
<p></p>
|
||||
|
||||
* [Installation](#installation)
|
||||
* [Installing via Homebrew](#installing-via-homebrew)
|
||||
* [Installing via MacPorts](#installing-via-macports)
|
||||
* [Installing a Binary](#installing-a-binary)
|
||||
* [Installing from Source](#installing-from-source)
|
||||
* [Running via Docker](#running-via-docker)
|
||||
* [Communication](#communication)
|
||||
* [Slack](#slack)
|
||||
* [Twitter](#twitter)
|
||||
* [Documentation](#documentation)
|
||||
* [Modules](#modules)
|
||||
* [Getting Bugs Fixed or Features Added](#getting-bugs-fixed-or-features-added)
|
||||
* [Contributing to the Source Code](#contributing-to-the-source-code)
|
||||
* [Adding Dependencies](#adding-dependencies)
|
||||
* [Contributing to the Documentation](#contributing-to-the-documentation)
|
||||
* [Contributors](#contributors)
|
||||
* [Acknowledgements](#acknowledgments)
|
||||
|
||||
<p align="center">
|
||||
<img src="./images/screenshot.jpg" title="screenshot" width="720" height="420" />
|
||||
</p>
|
||||
|
||||
## Installation
|
||||
|
||||
### Installing via Homebrew
|
||||
|
||||
The simplest way from Homebrew:
|
||||
|
||||
```console
|
||||
brew install wtfutil
|
||||
|
||||
wtfutil
|
||||
```
|
||||
|
||||
That version can sometimes lag a bit, as recipe updates take time to get accepted into `homebrew-core`. If you always want the bleeding edge of releases, you can tap it:
|
||||
|
||||
```console
|
||||
brew tap wtfutil/wtfutil
|
||||
brew install wtfutil
|
||||
|
||||
wtfutil
|
||||
```
|
||||
|
||||
### Installing via MacPorts
|
||||
|
||||
You can also install via [MacPorts](https://www.macports.org/):
|
||||
|
||||
```console
|
||||
sudo port selfupdate
|
||||
sudo port install wtfutil
|
||||
|
||||
wtfutil
|
||||
```
|
||||
|
||||
### Installing a Binary
|
||||
|
||||
[Download the latest binary](https://github.com/wtfutil/wtf/releases) from GitHub.
|
||||
|
||||
WTF is a stand-alone binary. Once downloaded, copy it to a location you can run executables from (ie: `/usr/local/bin/`), and set the permissions accordingly:
|
||||
|
||||
```bash
|
||||
chmod a+x /usr/local/bin/wtfutil
|
||||
```
|
||||
|
||||
and you should be good to go.
|
||||
|
||||
### Installing from Source
|
||||
|
||||
If you want to run the build command from within your `$GOPATH`:
|
||||
|
||||
```bash
|
||||
# Set the Go proxy
|
||||
export GOPROXY="https://proxy.golang.org,direct"
|
||||
|
||||
# Disable the Go checksum database
|
||||
export GOSUMDB=off
|
||||
|
||||
# Enable Go modules
|
||||
export GO111MODULE=on
|
||||
|
||||
go get -u github.com/wtfutil/wtf
|
||||
cd $GOPATH/src/github.com/wtfutil/wtf
|
||||
make install
|
||||
make run
|
||||
```
|
||||
|
||||
If you want to run the build command from a folder that is not in your `$GOPATH`:
|
||||
|
||||
```bash
|
||||
# Set the Go proxy
|
||||
export GOPROXY="https://proxy.golang.org,direct"
|
||||
|
||||
go get -u github.com/wtfutil/wtf
|
||||
cd $GOPATH/src/github.com/wtfutil/wtf
|
||||
make install
|
||||
make run
|
||||
```
|
||||
|
||||
### Installing from Source using Docker
|
||||
|
||||
All building is done inside a docker container. You can then copy the binary to
|
||||
your local machine.
|
||||
|
||||
```bash
|
||||
curl -o Dockerfile.build https://raw.githubusercontent.com/wtfutil/wtf/master/Dockerfile.build
|
||||
docker build -f Dockerfile.build -t wtfutil --build-arg=version=master .
|
||||
docker create --name wtf_build wtfutil
|
||||
docker cp wtf_build:/usr/local/bin/wtfutil ~/.local/bin
|
||||
docker rm wtf_build
|
||||
```
|
||||
|
||||
**Note:** WTF is _only_ compatible with Go versions **1.16.0** or later (due to the use of Go modules and newer standard library functions). If you would like to use `gccgo` to compile, you _must_ use `gccgo-9` or later which introduces support for Go modules.
|
||||
|
||||
### Installing via Arch User Repository
|
||||
|
||||
Arch Linux users can utilise the [wtfutil](https://aur.archlinux.org/packages/wtfutil) package to build it from source, or [wtfutil-bin](https://aur.archlinux.org/packages/wtfutil-bin/) to install pre-built binaries.
|
||||
|
||||
## Running via Docker
|
||||
|
||||
You can run `wtf` inside a docker container:
|
||||
|
||||
```bash
|
||||
# download or create the Dockerfile
|
||||
curl -o Dockerfile https://raw.githubusercontent.com/wtfutil/wtf/master/Dockerfile
|
||||
|
||||
# build the docker container
|
||||
docker build -t wtfutil .
|
||||
|
||||
# or for a particular tag or branch
|
||||
docker build --build-arg=version=v0.25.0 -t wtfutil .
|
||||
|
||||
# run the container
|
||||
docker run -it wtfutil
|
||||
|
||||
# run container with a local config file
|
||||
docker run -it -v path/to/config.yml:/config/config.yml wtfutil --config=/config/config.yml
|
||||
```
|
||||
|
||||
## Communication
|
||||
|
||||
### Slack
|
||||
@ -38,63 +169,56 @@ Find #wtfutil on https://gophers.slack.com/ and join us.
|
||||
|
||||
### Twitter
|
||||
|
||||
Also, follow [on Twitter](https://twitter.com/wtfutil) for news and latest updates.
|
||||
|
||||
## Quick Start
|
||||
|
||||
[Download and run the latest binary](https://github.com/wtfutil/wtf/releases) or install from source.
|
||||
|
||||
If you want to run the build command from within your `$GOPATH`:
|
||||
|
||||
```bash
|
||||
# Set the Go proxy variable to GoCenter
|
||||
export GOPROXY="https://gocenter.io"
|
||||
# Enable Go modules
|
||||
export GO111MODULE=on
|
||||
go get -u github.com/wtfutil/wtf
|
||||
cd $GOPATH/src/github.com/wtfutil/wtf
|
||||
make install
|
||||
make run
|
||||
```
|
||||
|
||||
If you want to run the build command from a folder that is not in your `$GOPATH`:
|
||||
|
||||
```bash
|
||||
# Set the Go proxy variable to GoCenter
|
||||
export GOPROXY="https://gocenter.io"
|
||||
go get -u github.com/wtfutil/wtf
|
||||
cd $GOPATH/src/github.com/wtfutil/wtf
|
||||
make install
|
||||
make run
|
||||
```
|
||||
|
||||
**Note:** WTF is _only_ compatible with Go versions **1.11.0** or later (due to the use of Go modules). It currently _does not_ compile with `gccgo`.
|
||||
Also, follow [on Twitter](https://twitter.com/wtfutil) for news and latest updates.
|
||||
|
||||
## Documentation
|
||||
|
||||
See [https://wtfutil.com](https://wtfutil.com) for the definitive
|
||||
documentation. Here's some short-cuts:
|
||||
|
||||
* [Installation](https://wtfutil.com/getting_started/installation/)
|
||||
* [Configuration](https://wtfutil.com/configuration/)
|
||||
* [Installation](https://wtfutil.com/quick_start/)
|
||||
* [Configuration](https://wtfutil.com/configuration/files/)
|
||||
* [Module Documentation](https://wtfutil.com/modules/)
|
||||
|
||||
### Contributing to the Documentation
|
||||
## Modules
|
||||
|
||||
Modules are the chunks of functionality that make WTF useful. Modules are added and configured by including their configuration values in your `config.yml` file. The documentation for each module describes how to configure them.
|
||||
|
||||
Some interesting modules you might consider adding to get you started:
|
||||
|
||||
* [DigitalOcean](https://wtfutil.com/modules/digitalocean/)
|
||||
* [GitHub](https://wtfutil.com/modules/github/)
|
||||
* [Google Calendar](https://wtfutil.com/modules/google/gcal/)
|
||||
* [HackerNews](https://wtfutil.com/modules/hackernews/)
|
||||
* [Have I Been Pwned](https://wtfutil.com/modules/hibp/)
|
||||
* [NewRelic](https://wtfutil.com/modules/newrelic/)
|
||||
* [OpsGenie](https://wtfutil.com/modules/opsgenie/)
|
||||
* [Security](https://wtfutil.com/modules/security/)
|
||||
* [Transmission](https://wtfutil.com/modules/transmission/)
|
||||
* [Trello](https://wtfutil.com/modules/trello/)
|
||||
|
||||
## Getting Bugs Fixed or Features Added
|
||||
|
||||
WTF is open-source software, informally maintained by a small collection of volunteers who come and go at their leisure. There are absolutely no guarantees that, even if an issue is opened for them, bugs will be fixed or features added.
|
||||
|
||||
If there is a bug that you really need to have fixed or a feature you really want to have implemented, you can greatly increase your chances of that happening by creating a bounty on [BountySource](https://www.bountysource.com) to provide an incentive for someone to tackle it.
|
||||
|
||||
## Contributing to the Source Code
|
||||
|
||||
First, kindly read [Talk, then code](https://dave.cheney.net/2019/02/18/talk-then-code) by Dave Cheney. It's great advice and will often save a lot of time and effort.
|
||||
|
||||
Next, kindly read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests.
|
||||
|
||||
Then create your branch, write your code, submit your PR, and join the rest of the awesome people who've contributed their time and effort towards WTF. Without their contributors, WTF wouldn't be possible.
|
||||
|
||||
Don't worry if you've never written Go before, or never contributed to an open source project before, or that your code won't be good enough. For a surprising number of people WTF has been their first Go project, or first open source contribution. If you're here, and you've read this far, you're the right stuff.
|
||||
|
||||
## Contributing to the Documentation
|
||||
|
||||
Documentation now lives in its own repository here: [https://github.com/wtfutil/wtfdocs](https://github.com/wtfutil/wtfdocs).
|
||||
|
||||
Please make all additions and updates to documentation in that repository.
|
||||
|
||||
## Contributing to the Source Code
|
||||
|
||||
First, please read [Talk, then code](https://dave.cheney.net/2019/02/18/talk-then-code) by Dave Cheney. It's great advice and will often save a lot of time and effort.
|
||||
|
||||
Next, please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests.
|
||||
|
||||
Then create your branch, write your code, submit your PR, and join the rest of the awesome people who've contributed their time and effort towards WTF. Without their contributors, WTF wouldn't be possible.
|
||||
|
||||
And don't worry if you've never written Go before, or never contributed to an open source project before, or that your code won't be good enough. For a surprising number of people WTF has been their first Go project, or first open source contribution. If you're here, and you've read this far, you're the right stuff.
|
||||
|
||||
### Adding Dependencies
|
||||
|
||||
Dependency management in WTF is handled by [Go modules](https://github.com/golang/go/wiki/Modules). Please check out that page for more details on how Go modules work.
|
||||
@ -102,19 +226,210 @@ Dependency management in WTF is handled by [Go modules](https://github.com/golan
|
||||
## Contributors
|
||||
|
||||
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
||||
<!-- prettier-ignore -->
|
||||
| [<img src="https://avatars0.githubusercontent.com/u/6413?v=4" width="48px;" alt="Chris Cummer"/><br /><sub><b>Chris Cummer</b></sub>](https://twitter.com/senorprogrammer)<br /> | [<img src="https://avatars2.githubusercontent.com/u/3252403?v=4" width="48px;" alt="Anand Sudhir Prayaga"/><br /><sub><b>Anand Sudhir Prayaga</b></sub>](https://github.com/anandsudhir)<br /> | [<img src="https://avatars1.githubusercontent.com/u/34973359?v=4" width="48px;" alt="Hossein Mehrabi"/><br /><sub><b>Hossein Mehrabi</b></sub>](https://github.com/jeangovil)<br /> | [<img src="https://avatars0.githubusercontent.com/u/11779018?v=4" width="48px;" alt="FengYa"/><br /><sub><b>FengYa</b></sub>](https://github.com/Fengyalv)<br /> | [<img src="https://avatars2.githubusercontent.com/u/17337753?v=4" width="48px;" alt="deltax"/><br /><sub><b>deltax</b></sub>](https://fluxionnetwork.github.io/fluxion/)<br /> | [<img src="https://avatars0.githubusercontent.com/u/1319630?v=4" width="48px;" alt="Bill Keenan"/><br /><sub><b>Bill Keenan</b></sub>](https://github.com/BillKeenan)<br /> | [<img src="https://avatars2.githubusercontent.com/u/118081?v=4" width="48px;" alt="June S"/><br /><sub><b>June S</b></sub>](http://blog.sapara.com)<br /> |
|
||||
| :---: | :---: | :---: | :---: | :---: | :---: | :---: |
|
||||
| [<img src="https://avatars3.githubusercontent.com/u/16461061?v=4" width="48px;" alt="liyiheng"/><br /><sub><b>liyiheng</b></sub>](https://github.com/XanthusL)<br /> | [<img src="https://avatars2.githubusercontent.com/u/9014288?v=4" width="48px;" alt="baustinanki"/><br /><sub><b>baustinanki</b></sub>](https://github.com/baustinanki)<br /> | [<img src="https://avatars0.githubusercontent.com/u/371475?v=4" width="48px;" alt="lucus lee"/><br /><sub><b>lucus lee</b></sub>](https://github.com/lixin9311)<br /> | [<img src="https://avatars1.githubusercontent.com/u/7537841?v=4" width="48px;" alt="Mike Lloyd"/><br /><sub><b>Mike Lloyd</b></sub>](https://github.com/mxplusb)<br /> | [<img src="https://avatars3.githubusercontent.com/u/10998?v=4" width="48px;" alt="Sergio Rubio"/><br /><sub><b>Sergio Rubio</b></sub>](http://rubiojr.rbel.co)<br /> | [<img src="https://avatars3.githubusercontent.com/u/17374492?v=4" width="48px;" alt="Farhad Farahi"/><br /><sub><b>Farhad Farahi</b></sub>](https://github.com/FarhadF)<br /> | [<img src="https://avatars1.githubusercontent.com/u/634604?v=4" width="48px;" alt="Lasantha Kularatne"/><br /><sub><b>Lasantha Kularatne</b></sub>](http://lasantha.blogspot.com/)<br /> |
|
||||
| [<img src="https://avatars1.githubusercontent.com/u/823331?v=4" width="48px;" alt="Mark Old"/><br /><sub><b>Mark Old</b></sub>](https://github.com/dlom)<br /> | [<img src="https://avatars0.githubusercontent.com/u/5546718?v=4" width="48px;" alt="flw"/><br /><sub><b>flw</b></sub>](http://flw.tools/)<br /> | [<img src="https://avatars0.githubusercontent.com/u/6024927?v=4" width="48px;" alt="David Barda"/><br /><sub><b>David Barda</b></sub>](https://github.com/davebarda)<br /> | [<img src="https://avatars2.githubusercontent.com/u/4261980?v=4" width="48px;" alt="Geoff Lee"/><br /><sub><b>Geoff Lee</b></sub>](https://github.com/matrinox)<br /> | [<img src="https://avatars3.githubusercontent.com/u/1022918?v=4" width="48px;" alt="George Opritescu"/><br /><sub><b>George Opritescu</b></sub>](http://international.github.io)<br /> | [<img src="https://avatars3.githubusercontent.com/u/497310?v=4" width="48px;" alt="Grazfather"/><br /><sub><b>Grazfather</b></sub>](https://twitter.com/Grazfather)<br /> | [<img src="https://avatars2.githubusercontent.com/u/1691120?v=4" width="48px;" alt="Michael Cordell"/><br /><sub><b>Michael Cordell</b></sub>](http://www.mikecordell.com/)<br /> |
|
||||
| [<img src="https://avatars2.githubusercontent.com/u/1215497?v=4" width="48px;" alt="Patrick José Pereira"/><br /><sub><b>Patrick José Pereira</b></sub>](http://patrick.ibexcps.com)<br /> | [<img src="https://avatars2.githubusercontent.com/u/1483092?v=4" width="48px;" alt="sherod taylor"/><br /><sub><b>sherod taylor</b></sub>](https://github.com/sherodtaylor)<br /> | [<img src="https://avatars2.githubusercontent.com/u/3062663?v=4" width="48px;" alt="Andrew Scott"/><br /><sub><b>Andrew Scott</b></sub>](http://cogentia.io)<br /> | [<img src="https://avatars1.githubusercontent.com/u/12018440?v=4" width="48px;" alt="Lassi Piironen"/><br /><sub><b>Lassi Piironen</b></sub>](https://github.com/lsipii)<br /> | [<img src="https://avatars0.githubusercontent.com/u/14799210?v=4" width="48px;" alt="BlackWebWolf"/><br /><sub><b>BlackWebWolf</b></sub>](https://github.com/BlackWebWolf)<br /> | [<img src="https://avatars0.githubusercontent.com/u/1894885?v=4" width="48px;" alt="andrewzolotukhin"/><br /><sub><b>andrewzolotukhin</b></sub>](https://github.com/andrewzolotukhin)<br /> | [<img src="https://avatars1.githubusercontent.com/u/8568280?v=4" width="48px;" alt="Leon Stigter"/><br /><sub><b>Leon Stigter</b></sub>](https://retgits.github.io)<br /> |
|
||||
| [<img src="https://avatars3.githubusercontent.com/u/21756?v=4" width="48px;" alt="Amr Tamimi"/><br /><sub><b>Amr Tamimi</b></sub>](https://tamimi.se)<br /> | [<img src="https://avatars3.githubusercontent.com/u/3717137?v=4" width="48px;" alt="Jagdeep Singh"/><br /><sub><b>Jagdeep Singh</b></sub>](https://jagdeep.me)<br /> | [<img src="https://avatars0.githubusercontent.com/u/889171?v=4" width="48px;" alt="Lineu Felipe"/><br /><sub><b>Lineu Felipe</b></sub>](https://github.com/darkSasori)<br /> | [<img src="https://avatars2.githubusercontent.com/u/159124?v=4" width="48px;" alt="Konstantin"/><br /><sub><b>Konstantin</b></sub>](https://github.com/kvj)<br /> | [<img src="https://avatars2.githubusercontent.com/u/6044920?v=4" width="48px;" alt="Brendan O'Leary"/><br /><sub><b>Brendan O'Leary</b></sub>](http://www.brendanoleary.com)<br /> | [<img src="https://avatars2.githubusercontent.com/u/1226441?v=4" width="48px;" alt="bertl4398"/><br /><sub><b>bertl4398</b></sub>](https://github.com/bertl4398)<br /> | [<img src="https://avatars2.githubusercontent.com/u/6553695?v=4" width="48px;" alt="Ferenc-"/><br /><sub><b>Ferenc-</b></sub>](https://github.com/Ferenc-)<br /> |
|
||||
| [<img src="https://avatars1.githubusercontent.com/u/952036?v=4" width="48px;" alt="Rohan Verma"/><br /><sub><b>Rohan Verma</b></sub>](http://rohanverma.net)<br /> | [<img src="https://avatars1.githubusercontent.com/u/19293566?v=4" width="48px;" alt="Tim Fitzgerald"/><br /><sub><b>Tim Fitzgerald</b></sub>](https://github.com/fimtitzgerald)<br /> | [<img src="https://avatars2.githubusercontent.com/u/1081051?v=4" width="48px;" alt="Federico Ruggi"/><br /><sub><b>Federico Ruggi</b></sub>](https://github.com/ruggi)<br /> | [<img src="https://avatars2.githubusercontent.com/u/7293328?v=4" width="48px;" alt="Craig Woodward"/><br /><sub><b>Craig Woodward</b></sub>](https://github.com/ctwoodward)<br /> | [<img src="https://avatars3.githubusercontent.com/u/15367484?v=4" width="48px;" alt="ReadmeCritic"/><br /><sub><b>ReadmeCritic</b></sub>](https://twitter.com/ReadmeCritic)<br /> | [<img src="https://avatars0.githubusercontent.com/u/141402?v=4" width="48px;" alt="Eugene"/><br /><sub><b>Eugene</b></sub>](https://github.com/jdevelop)<br /> | [<img src="https://avatars1.githubusercontent.com/u/12983705?s=460&v=4" width="48px;" alt="Kenny Wu"/><br /><sub><b>Kenny Wu</b></sub>](https://github.com/Trinergy)<br /> |
|
||||
| [<img src="https://avatars0.githubusercontent.com/u/538234?v=4" width="48px;" alt="Renán Romero"/><br /><sub><b>Renán Romero</b></sub>](http://www.romeroruiz.com)<br /> | [<img src="https://avatars1.githubusercontent.com/u/5031240?v=4" width="48px;" alt="Bastian Groß"/><br /><sub><b>Bastian Groß</b></sub>](https://github.com/sticreations)<br /> | [<img src="https://avatars1.githubusercontent.com/u/2496835?v=4" width="48px;" alt="nicholas-eden"/><br /><sub><b>nicholas-eden</b></sub>](https://github.com/nicholas-eden)<br /> | [<img src="https://avatars1.githubusercontent.com/u/279390?v=4" width="48px;" alt="Dan Rabinowitz"/><br /><sub><b>Dan Rabinowitz</b></sub>](https://github.com/danrabinowitz)<br /> | [<img src="https://avatars1.githubusercontent.com/u/6897575?v=4" width="48px;" alt="David Missmann"/><br /><sub><b>David Missmann</b></sub>](https://github.com/dvdmssmnn)<br /> | [<img src="https://avatars2.githubusercontent.com/u/882006?v=4" width="48px;" alt="Mathias Weber"/><br /><sub><b>Mathias Weber</b></sub>](https://github.com/mweb)<br /> | [<img src="https://avatars1.githubusercontent.com/u/32081703?v=4" width="48px;" alt="TheRedSpy15"/><br /><sub><b>TheRedSpy15</b></sub>](https://github.com/TheRedSpy15)<br /> |
|
||||
| [<img src="https://avatars0.githubusercontent.com/u/9569897?v=4" width="48px;" alt="Harald Nordgren"/><br /><sub><b>Harald Nordgren</b></sub>](https://www.linkedin.com/in/harald-nordgren-44778192)<br /> | [<img src="https://avatars0.githubusercontent.com/u/11583824?v=4" width="48px;" alt="Matei Alexandru Gardus"/><br /><sub><b>Matei Alexandru Gardus</b></sub>](http://stormfirefox1.github.io)<br /> | [<img src="https://avatars2.githubusercontent.com/u/1523955?v=4" width="48px;" alt="Sean Smith"/><br /><sub><b>Sean Smith</b></sub>](https://github.com/Seanstoppable)<br /> | [<img src="https://avatars1.githubusercontent.com/u/1646238?v=4" width="48px;" alt="Halil Kaskavalci"/><br /><sub><b>Halil Kaskavalci</b></sub>](http://kaskavalci.com)<br /> | [<img src="https://avatars2.githubusercontent.com/u/246715?v=4" width="48px;" alt="Johan Denoyer"/><br /><sub><b>Johan Denoyer</b></sub>](http://www.johandenoyer.fr)<br /> | [<img src="https://avatars1.githubusercontent.com/u/593516?v=4" width="48px;" alt="Jelle Vink"/><br /><sub><b>Jelle Vink</b></sub>](https://skymeyer.be)<br /> | [<img src="https://avatars1.githubusercontent.com/u/3997333?v=4" width="48px;" alt="Devin Collins"/><br /><sub><b>Devin Collins</b></sub>](http://imdevinc.com)<br /> |
|
||||
| [<img src="https://avatars3.githubusercontent.com/u/18333?v=4" width="48px;" alt="Danne Stayskal"/><br /><sub><b>Danne Stayskal</b></sub>](http://danne.stayskal.com/)<br /> | [<img src="https://avatars1.githubusercontent.com/u/2006658?v=4" width="48px;" alt="Max Beizer"/><br /><sub><b>Max Beizer</b></sub>](https://www.maxbeizer.com)<br /> | [<img src="https://avatars1.githubusercontent.com/u/194392?v=4" width="48px;" alt="E:V:A"/><br /><sub><b>E:V:A</b></sub>](http://tinyurl.com/nwmj4as)<br /> | [<img src="https://avatars0.githubusercontent.com/u/1425500?v=4" width="48px;" alt="Gabriel"/><br /><sub><b>Gabriel</b></sub>](https://github.com/GaboFDC)<br /> | [<img src="https://avatars2.githubusercontent.com/u/10111411?v=4" width="48px;" alt="Andrew Scibek"/><br /><sub><b>Andrew Scibek</b></sub>](https://github.com/AndrewScibek)<br /> | [<img src="https://avatars0.githubusercontent.com/u/29709822?v=4" width="48px;" alt="FriedCosey"/><br /><sub><b>FriedCosey</b></sub>](https://github.com/FriedCosey)<br /> | [<img src="https://avatars1.githubusercontent.com/u/3891?v=4" width="48px;" alt="Michele Gerarduzzi"/><br /><sub><b>Michele Gerarduzzi</b></sub>](https://michelegera.dev/)<br /> |
|
||||
| [<img src="https://avatars3.githubusercontent.com/u/13438569?v=4" width="48px;" alt="Jack Morris"/><br /><sub><b>Jack Morris</b></sub>](https://github.com/rudolphjacksonm)<br /> | [<img src="https://avatars0.githubusercontent.com/u/14993807?v=4" width="48px;" alt="foorb"/><br /><sub><b>foorb</b></sub>](https://github.com/foorb)<br /> | [<img src="https://avatars0.githubusercontent.com/u/5819098?v=4" width="48px;" alt="Levi Baber"/><br /><sub><b>Levi Baber</b></sub>](http://researchit.las.iastate.edu)<br /> | [<img src="https://avatars0.githubusercontent.com/u/38514?v=4" width="48px;" alt="Graham Anderson"/><br /><sub><b>Graham Anderson</b></sub>](https://github.com/gnanderson)<br /> | [<img src="https://avatars2.githubusercontent.com/u/1936828?v=4" width="48px;" alt="Romain Bossart"/><br /><sub><b>Romain Bossart</b></sub>](https://github.com/bosr)<br /> | [<img src="https://avatars0.githubusercontent.com/u/969838?v=4" width="48px;" alt="Kirill Motkov"/><br /><sub><b>Kirill Motkov</b></sub>](http://eonix.ru)<br /> | [<img src="https://avatars1.githubusercontent.com/u/3665694?v=4" width="48px;" alt="Brian Choromanski"/><br /><sub><b>Brian Choromanski</b></sub>](http://www.BrianChoromanski.com)<br /> |
|
||||
| [<img src="https://avatars0.githubusercontent.com/u/1302304?v=4" width="48px;" alt="Sean DuBois"/><br /><sub><b>Sean DuBois</b></sub>](http://siobud.com)<br /> |
|
||||
<!-- prettier-ignore-start -->
|
||||
<!-- markdownlint-disable -->
|
||||
<table>
|
||||
<tr>
|
||||
<td align="center"><a href="https://twitter.com/senorprogrammer"><img src="https://avatars0.githubusercontent.com/u/6413?v=4" width="48px;" alt=""/><br /><sub><b>Chris Cummer</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/anandsudhir"><img src="https://avatars2.githubusercontent.com/u/3252403?v=4" width="48px;" alt=""/><br /><sub><b>Anand Sudhir Prayaga</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/jeangovil"><img src="https://avatars1.githubusercontent.com/u/34973359?v=4" width="48px;" alt=""/><br /><sub><b>Hossein Mehrabi</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/Fengyalv"><img src="https://avatars0.githubusercontent.com/u/11779018?v=4" width="48px;" alt=""/><br /><sub><b>FengYa</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://fluxionnetwork.github.io/fluxion/"><img src="https://avatars2.githubusercontent.com/u/17337753?v=4" width="48px;" alt=""/><br /><sub><b>deltax</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/BillKeenan"><img src="https://avatars0.githubusercontent.com/u/1319630?v=4" width="48px;" alt=""/><br /><sub><b>Bill Keenan</b></sub></a><br /></td>
|
||||
<td align="center"><a href="http://blog.sapara.com"><img src="https://avatars2.githubusercontent.com/u/118081?v=4" width="48px;" alt=""/><br /><sub><b>June S</b></sub></a><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="https://github.com/XanthusL"><img src="https://avatars3.githubusercontent.com/u/16461061?v=4" width="48px;" alt=""/><br /><sub><b>liyiheng</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/baustinanki"><img src="https://avatars2.githubusercontent.com/u/9014288?v=4" width="48px;" alt=""/><br /><sub><b>baustinanki</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/lixin9311"><img src="https://avatars0.githubusercontent.com/u/371475?v=4" width="48px;" alt=""/><br /><sub><b>lucus lee</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/mxplusb"><img src="https://avatars1.githubusercontent.com/u/7537841?v=4" width="48px;" alt=""/><br /><sub><b>Mike Lloyd</b></sub></a><br /></td>
|
||||
<td align="center"><a href="http://rubiojr.rbel.co"><img src="https://avatars3.githubusercontent.com/u/10998?v=4" width="48px;" alt=""/><br /><sub><b>Sergio Rubio</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/FarhadF"><img src="https://avatars3.githubusercontent.com/u/17374492?v=4" width="48px;" alt=""/><br /><sub><b>Farhad Farahi</b></sub></a><br /></td>
|
||||
<td align="center"><a href="http://lasantha.blogspot.com/"><img src="https://avatars1.githubusercontent.com/u/634604?v=4" width="48px;" alt=""/><br /><sub><b>Lasantha Kularatne</b></sub></a><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="https://github.com/dlom"><img src="https://avatars1.githubusercontent.com/u/823331?v=4" width="48px;" alt=""/><br /><sub><b>Mark Old</b></sub></a><br /></td>
|
||||
<td align="center"><a href="http://flw.tools/"><img src="https://avatars0.githubusercontent.com/u/5546718?v=4" width="48px;" alt=""/><br /><sub><b>flw</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/davebarda"><img src="https://avatars0.githubusercontent.com/u/6024927?v=4" width="48px;" alt=""/><br /><sub><b>David Barda</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/matrinox"><img src="https://avatars2.githubusercontent.com/u/4261980?v=4" width="48px;" alt=""/><br /><sub><b>Geoff Lee</b></sub></a><br /></td>
|
||||
<td align="center"><a href="http://international.github.io"><img src="https://avatars3.githubusercontent.com/u/1022918?v=4" width="48px;" alt=""/><br /><sub><b>George Opritescu</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://twitter.com/Grazfather"><img src="https://avatars3.githubusercontent.com/u/497310?v=4" width="48px;" alt=""/><br /><sub><b>Grazfather</b></sub></a><br /></td>
|
||||
<td align="center"><a href="http://www.mikecordell.com/"><img src="https://avatars2.githubusercontent.com/u/1691120?v=4" width="48px;" alt=""/><br /><sub><b>Michael Cordell</b></sub></a><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="http://patrick.ibexcps.com"><img src="https://avatars2.githubusercontent.com/u/1215497?v=4" width="48px;" alt=""/><br /><sub><b>Patrick José Pereira</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/sherodtaylor"><img src="https://avatars2.githubusercontent.com/u/1483092?v=4" width="48px;" alt=""/><br /><sub><b>sherod taylor</b></sub></a><br /></td>
|
||||
<td align="center"><a href="http://cogentia.io"><img src="https://avatars2.githubusercontent.com/u/3062663?v=4" width="48px;" alt=""/><br /><sub><b>Andrew Scott</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/lsipii"><img src="https://avatars1.githubusercontent.com/u/12018440?v=4" width="48px;" alt=""/><br /><sub><b>Lassi Piironen</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/BlackWebWolf"><img src="https://avatars0.githubusercontent.com/u/14799210?v=4" width="48px;" alt=""/><br /><sub><b>BlackWebWolf</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/andrewzolotukhin"><img src="https://avatars0.githubusercontent.com/u/1894885?v=4" width="48px;" alt=""/><br /><sub><b>andrewzolotukhin</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://retgits.github.io"><img src="https://avatars1.githubusercontent.com/u/8568280?v=4" width="48px;" alt=""/><br /><sub><b>Leon Stigter</b></sub></a><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="https://tamimi.se"><img src="https://avatars3.githubusercontent.com/u/21756?v=4" width="48px;" alt=""/><br /><sub><b>Amr Tamimi</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://jagdeep.me"><img src="https://avatars3.githubusercontent.com/u/3717137?v=4" width="48px;" alt=""/><br /><sub><b>Jagdeep Singh</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/darkSasori"><img src="https://avatars0.githubusercontent.com/u/889171?v=4" width="48px;" alt=""/><br /><sub><b>Lineu Felipe</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/kvj"><img src="https://avatars2.githubusercontent.com/u/159124?v=4" width="48px;" alt=""/><br /><sub><b>Konstantin</b></sub></a><br /></td>
|
||||
<td align="center"><a href="http://www.brendanoleary.com"><img src="https://avatars2.githubusercontent.com/u/6044920?v=4" width="48px;" alt=""/><br /><sub><b>Brendan O'Leary</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/bertl4398"><img src="https://avatars2.githubusercontent.com/u/1226441?v=4" width="48px;" alt=""/><br /><sub><b>bertl4398</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/Ferenc-"><img src="https://avatars2.githubusercontent.com/u/6553695?v=4" width="48px;" alt=""/><br /><sub><b>Ferenc-</b></sub></a><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="http://rohanverma.net"><img src="https://avatars1.githubusercontent.com/u/952036?v=4" width="48px;" alt=""/><br /><sub><b>Rohan Verma</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/fimtitzgerald"><img src="https://avatars1.githubusercontent.com/u/19293566?v=4" width="48px;" alt=""/><br /><sub><b>Tim Fitzgerald</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/ruggi"><img src="https://avatars2.githubusercontent.com/u/1081051?v=4" width="48px;" alt=""/><br /><sub><b>Federico Ruggi</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/ctwoodward"><img src="https://avatars2.githubusercontent.com/u/7293328?v=4" width="48px;" alt=""/><br /><sub><b>Craig Woodward</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://twitter.com/ReadmeCritic"><img src="https://avatars3.githubusercontent.com/u/15367484?v=4" width="48px;" alt=""/><br /><sub><b>ReadmeCritic</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/jdevelop"><img src="https://avatars0.githubusercontent.com/u/141402?v=4" width="48px;" alt=""/><br /><sub><b>Eugene</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/Trinergy"><img src="https://avatars1.githubusercontent.com/u/12983705?s=460&v=4" width="48px;" alt=""/><br /><sub><b>Kenny Wu</b></sub></a><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="http://www.romeroruiz.com"><img src="https://avatars0.githubusercontent.com/u/538234?v=4" width="48px;" alt=""/><br /><sub><b>Renán Romero</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/sticreations"><img src="https://avatars1.githubusercontent.com/u/5031240?v=4" width="48px;" alt=""/><br /><sub><b>Bastian Groß</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/nicholas-eden"><img src="https://avatars1.githubusercontent.com/u/2496835?v=4" width="48px;" alt=""/><br /><sub><b>nicholas-eden</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/danrabinowitz"><img src="https://avatars1.githubusercontent.com/u/279390?v=4" width="48px;" alt=""/><br /><sub><b>Dan Rabinowitz</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/dvdmssmnn"><img src="https://avatars1.githubusercontent.com/u/6897575?v=4" width="48px;" alt=""/><br /><sub><b>David Missmann</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/mweb"><img src="https://avatars2.githubusercontent.com/u/882006?v=4" width="48px;" alt=""/><br /><sub><b>Mathias Weber</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/TheRedSpy15"><img src="https://avatars1.githubusercontent.com/u/32081703?v=4" width="48px;" alt=""/><br /><sub><b>TheRedSpy15</b></sub></a><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="https://www.linkedin.com/in/harald-nordgren-44778192"><img src="https://avatars0.githubusercontent.com/u/9569897?v=4" width="48px;" alt=""/><br /><sub><b>Harald Nordgren</b></sub></a><br /></td>
|
||||
<td align="center"><a href="http://stormfirefox1.github.io"><img src="https://avatars0.githubusercontent.com/u/11583824?v=4" width="48px;" alt=""/><br /><sub><b>Matei Alexandru Gardus</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/Seanstoppable"><img src="https://avatars2.githubusercontent.com/u/1523955?v=4" width="48px;" alt=""/><br /><sub><b>Sean Smith</b></sub></a><br /></td>
|
||||
<td align="center"><a href="http://kaskavalci.com"><img src="https://avatars1.githubusercontent.com/u/1646238?v=4" width="48px;" alt=""/><br /><sub><b>Halil Kaskavalci</b></sub></a><br /></td>
|
||||
<td align="center"><a href="http://www.johandenoyer.fr"><img src="https://avatars2.githubusercontent.com/u/246715?v=4" width="48px;" alt=""/><br /><sub><b>Johan Denoyer</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://skymeyer.be"><img src="https://avatars1.githubusercontent.com/u/593516?v=4" width="48px;" alt=""/><br /><sub><b>Jelle Vink</b></sub></a><br /></td>
|
||||
<td align="center"><a href="http://imdevinc.com"><img src="https://avatars1.githubusercontent.com/u/3997333?v=4" width="48px;" alt=""/><br /><sub><b>Devin Collins</b></sub></a><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="http://danne.stayskal.com/"><img src="https://avatars3.githubusercontent.com/u/18333?v=4" width="48px;" alt=""/><br /><sub><b>Danne Stayskal</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://www.maxbeizer.com"><img src="https://avatars1.githubusercontent.com/u/2006658?v=4" width="48px;" alt=""/><br /><sub><b>Max Beizer</b></sub></a><br /></td>
|
||||
<td align="center"><a href="http://tinyurl.com/nwmj4as"><img src="https://avatars1.githubusercontent.com/u/194392?v=4" width="48px;" alt=""/><br /><sub><b>E:V:A</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/GaboFDC"><img src="https://avatars0.githubusercontent.com/u/1425500?v=4" width="48px;" alt=""/><br /><sub><b>Gabriel</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/AndrewScibek"><img src="https://avatars2.githubusercontent.com/u/10111411?v=4" width="48px;" alt=""/><br /><sub><b>Andrew Scibek</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/FriedCosey"><img src="https://avatars0.githubusercontent.com/u/29709822?v=4" width="48px;" alt=""/><br /><sub><b>FriedCosey</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://michelegera.dev/"><img src="https://avatars1.githubusercontent.com/u/3891?v=4" width="48px;" alt=""/><br /><sub><b>Michele Gerarduzzi</b></sub></a><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="https://github.com/rudolphjacksonm"><img src="https://avatars3.githubusercontent.com/u/13438569?v=4" width="48px;" alt=""/><br /><sub><b>Jack Morris</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/foorb"><img src="https://avatars0.githubusercontent.com/u/14993807?v=4" width="48px;" alt=""/><br /><sub><b>foorb</b></sub></a><br /></td>
|
||||
<td align="center"><a href="http://researchit.las.iastate.edu"><img src="https://avatars0.githubusercontent.com/u/5819098?v=4" width="48px;" alt=""/><br /><sub><b>Levi Baber</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/gnanderson"><img src="https://avatars0.githubusercontent.com/u/38514?v=4" width="48px;" alt=""/><br /><sub><b>Graham Anderson</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/bosr"><img src="https://avatars2.githubusercontent.com/u/1936828?v=4" width="48px;" alt=""/><br /><sub><b>Romain Bossart</b></sub></a><br /></td>
|
||||
<td align="center"><a href="http://eonix.ru"><img src="https://avatars0.githubusercontent.com/u/969838?v=4" width="48px;" alt=""/><br /><sub><b>Kirill Motkov</b></sub></a><br /></td>
|
||||
<td align="center"><a href="http://www.BrianChoromanski.com"><img src="https://avatars1.githubusercontent.com/u/3665694?v=4" width="48px;" alt=""/><br /><sub><b>Brian Choromanski</b></sub></a><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="http://siobud.com"><img src="https://avatars0.githubusercontent.com/u/1302304?v=4" width="48px;" alt=""/><br /><sub><b>Sean DuBois</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/gary-kim"><img src="https://avatars1.githubusercontent.com/u/47195730?v=4" width="48px;" alt=""/><br /><sub><b>Gary Kim</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://dylanbartels.com"><img src="https://avatars1.githubusercontent.com/u/6660171?v=4" width="48px;" alt=""/><br /><sub><b>Dylan</b></sub></a><br /></td>
|
||||
<td align="center"><a href="http://liet.me"><img src="https://avatars0.githubusercontent.com/u/1990354?v=4" width="48px;" alt=""/><br /><sub><b>Dmytro Prokhorenkov</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/elliotrushton"><img src="https://avatars1.githubusercontent.com/u/590442?v=4" width="48px;" alt=""/><br /><sub><b>Elliot</b></sub></a><br /></td>
|
||||
<td align="center"><a href="http://chenrui.dev"><img src="https://avatars3.githubusercontent.com/u/1580956?v=4" width="48px;" alt=""/><br /><sub><b>chenrui</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/sudermanjr"><img src="https://avatars0.githubusercontent.com/u/7624765?v=4" width="48px;" alt=""/><br /><sub><b>Andrew Suderman</b></sub></a><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="https://github.com/rwhogg"><img src="https://avatars3.githubusercontent.com/u/2373856?v=4" width="48px;" alt=""/><br /><sub><b>Bob 'Wombat' Hogg</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/hxw"><img src="https://avatars0.githubusercontent.com/u/143462?v=4" width="48px;" alt=""/><br /><sub><b>Christopher Hall</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/hneiva"><img src="https://avatars1.githubusercontent.com/u/3451557?v=4" width="48px;" alt=""/><br /><sub><b>Heitor Neiva</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/herbygillot"><img src="https://avatars3.githubusercontent.com/u/618376?v=4" width="48px;" alt=""/><br /><sub><b>Herby Gillot</b></sub></a><br /></td>
|
||||
<td align="center"><a href="http://brudil.com"><img src="https://avatars3.githubusercontent.com/u/382352?v=4" width="48px;" alt=""/><br /><sub><b>James Canning</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://twitter.com/jeffz4000"><img src="https://avatars1.githubusercontent.com/u/45892?v=4" width="48px;" alt=""/><br /><sub><b>jeffz</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://mikkeljuhl.com"><img src="https://avatars0.githubusercontent.com/u/1764035?v=4" width="48px;" alt=""/><br /><sub><b>Mikkel Jeppesen Juhl</b></sub></a><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="https://github.com/lesteenman"><img src="https://avatars1.githubusercontent.com/u/963290?v=4" width="48px;" alt=""/><br /><sub><b>Erik</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/nyourchuck"><img src="https://avatars1.githubusercontent.com/u/155574?v=4" width="48px;" alt=""/><br /><sub><b>Nate Yourchuck</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://cprimozic.net/"><img src="https://avatars3.githubusercontent.com/u/4335849?v=4" width="48px;" alt=""/><br /><sub><b>Casey Primozic</b></sub></a><br /></td>
|
||||
<td align="center"><a href="http://pierdelacabeza.com/maruja"><img src="https://avatars3.githubusercontent.com/u/2430915?v=4" width="48px;" alt=""/><br /><sub><b>Alvaro [Andor]</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/Midnight-Conqueror"><img src="https://avatars1.githubusercontent.com/u/17101621?v=4" width="48px;" alt=""/><br /><sub><b>Joel Valentine</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://www.viktor-braun.de"><img src="https://avatars0.githubusercontent.com/u/4738210?v=4" width="48px;" alt=""/><br /><sub><b>Viktor Braun</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://www.chrisdbrown.co.uk/"><img src="https://avatars3.githubusercontent.com/u/3877652?v=4" width="48px;" alt=""/><br /><sub><b>ChrisDBrown</b></sub></a><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="https://narengowda.github.io/"><img src="https://avatars2.githubusercontent.com/u/582821?v=4" width="48px;" alt=""/><br /><sub><b>Narendra L</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/ibaum"><img src="https://avatars1.githubusercontent.com/u/24609103?v=4" width="48px;" alt=""/><br /><sub><b>ibaum</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/noxer"><img src="https://avatars3.githubusercontent.com/u/566185?v=4" width="48px;" alt=""/><br /><sub><b>Tim Scheuermann</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://indradhanush.github.io/"><img src="https://avatars0.githubusercontent.com/u/2682729?v=4" width="48px;" alt=""/><br /><sub><b>Indradhanush Gupta</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://victoravelar.com"><img src="https://avatars3.githubusercontent.com/u/7926849?v=4" width="48px;" alt=""/><br /><sub><b>Victor Hugo Avelar Ossorio</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/scw007"><img src="https://avatars3.githubusercontent.com/u/4001640?v=4" width="48px;" alt=""/><br /><sub><b>Steven Whitehead</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/lawrencecraft"><img src="https://avatars0.githubusercontent.com/u/660580?v=4" width="48px;" alt=""/><br /><sub><b>Lawrence Craft</b></sub></a><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="http://avi.press"><img src="https://avatars1.githubusercontent.com/u/1388071?v=4" width="48px;" alt=""/><br /><sub><b>Avi Press</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/Tardog"><img src="https://avatars0.githubusercontent.com/u/22562624?v=4" width="48px;" alt=""/><br /><sub><b>Sarah Kraßnigg</b></sub></a><br /></td>
|
||||
<td align="center"><a href="http://jmks.ca"><img src="https://avatars1.githubusercontent.com/u/4923990?v=4" width="48px;" alt=""/><br /><sub><b>Jason Schweier</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/massa1240"><img src="https://avatars2.githubusercontent.com/u/8268483?v=4" width="48px;" alt=""/><br /><sub><b>Massa</b></sub></a><br /></td>
|
||||
<td align="center"><a href="http://boot-error.github.io"><img src="https://avatars3.githubusercontent.com/u/8546140?v=4" width="48px;" alt=""/><br /><sub><b>Vighnesh SK</b></sub></a><br /></td>
|
||||
<td align="center"><a href="http://alexfornuto.com"><img src="https://avatars3.githubusercontent.com/u/2349184?v=4" width="48px;" alt=""/><br /><sub><b>Alex Fornuto</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/stevenwhitehead"><img src="https://avatars0.githubusercontent.com/u/30630257?v=4" width="48px;" alt=""/><br /><sub><b>stevenwhitehead</b></sub></a><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="https://github.com/jdenoy-saagie"><img src="https://avatars2.githubusercontent.com/u/55875303?v=4" width="48px;" alt=""/><br /><sub><b>Johan Denoyer</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://albertsalim.dev"><img src="https://avatars1.githubusercontent.com/u/4749355?v=4" width="48px;" alt=""/><br /><sub><b>Albert Salim</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://Feliciano.Tech"><img src="https://avatars1.githubusercontent.com/u/6017470?v=4" width="48px;" alt=""/><br /><sub><b>Ricardo N Feliciano</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/3mard"><img src="https://avatars3.githubusercontent.com/u/42009880?v=4" width="48px;" alt=""/><br /><sub><b>Omer Davutoglu</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/hemu"><img src="https://avatars0.githubusercontent.com/u/1871299?v=4" width="48px;" alt=""/><br /><sub><b>Hemu</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/Daanikus"><img src="https://avatars0.githubusercontent.com/u/18027087?v=4" width="48px;" alt=""/><br /><sub><b>Dan Bent</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://cizer.dev"><img src="https://avatars3.githubusercontent.com/u/20225764?v=4" width="48px;" alt=""/><br /><sub><b>C123R</b></sub></a><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="https://github.com/madepolli"><img src="https://avatars1.githubusercontent.com/u/7237000?v=4" width="48px;" alt=""/><br /><sub><b>Matjaž Depolli</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://blog.schoentoon.blue"><img src="https://avatars1.githubusercontent.com/u/417618?v=4" width="48px;" alt=""/><br /><sub><b>Toon Schoenmakers</b></sub></a><br /></td>
|
||||
<td align="center"><a href="http://tdhttt.com"><img src="https://avatars2.githubusercontent.com/u/24703459?v=4" width="48px;" alt=""/><br /><sub><b>TDHTTTT</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/jottr"><img src="https://avatars0.githubusercontent.com/u/2744198?v=4" width="48px;" alt=""/><br /><sub><b>jottr</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://www.linkedin.com/in/nikolay-mateev-79187b167/"><img src="https://avatars3.githubusercontent.com/u/15074116?v=4" width="48px;" alt=""/><br /><sub><b>Nikolay Mateev</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://charliewang.io"><img src="https://avatars1.githubusercontent.com/u/1320418?v=4" width="48px;" alt=""/><br /><sub><b>Charlie Wang</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/liyiheng"><img src="https://avatars3.githubusercontent.com/u/16461061?v=4" width="48px;" alt=""/><br /><sub><b>liyiheng</b></sub></a><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="https://bjoern.svbtle.com"><img src="https://avatars1.githubusercontent.com/u/1467156?v=4" width="48px;" alt=""/><br /><sub><b>Bjoern Weidlich</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/firecat53"><img src="https://avatars1.githubusercontent.com/u/568113?v=4" width="48px;" alt=""/><br /><sub><b>Scott Hansen</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://davidsbond.github.io"><img src="https://avatars3.githubusercontent.com/u/6227720?v=4" width="48px;" alt=""/><br /><sub><b>David Bond</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/yesnault"><img src="https://avatars3.githubusercontent.com/u/395454?v=4" width="48px;" alt=""/><br /><sub><b>Yvonnick Esnault</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/leterio"><img src="https://avatars0.githubusercontent.com/u/15060358?v=4" width="48px;" alt=""/><br /><sub><b>Vinícius Letério</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://adriano.fyi"><img src="https://avatars3.githubusercontent.com/u/3331648?v=4" width="48px;" alt=""/><br /><sub><b>Adriano</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/jonhadfield"><img src="https://avatars1.githubusercontent.com/u/843944?v=4" width="48px;" alt=""/><br /><sub><b>Jon Hadfield</b></sub></a><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="https://github.com/Tdnshah"><img src="https://avatars2.githubusercontent.com/u/13272752?v=4" width="48px;" alt=""/><br /><sub><b>Tejas Shah</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/mogensen"><img src="https://avatars2.githubusercontent.com/u/592710?v=4" width="48px;" alt=""/><br /><sub><b>Frederik Mogensen</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/rsaarelm"><img src="https://avatars1.githubusercontent.com/u/41840?v=4" width="48px;" alt=""/><br /><sub><b>Risto Saarelma</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://sam-github.github.io/"><img src="https://avatars2.githubusercontent.com/u/17607?v=4" width="48px;" alt=""/><br /><sub><b>Sam Roberts</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/gerchardon"><img src="https://avatars0.githubusercontent.com/u/5973160?v=4" width="48px;" alt=""/><br /><sub><b>gerchardon</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/mryanmurphy"><img src="https://avatars2.githubusercontent.com/u/641427?v=4" width="48px;" alt=""/><br /><sub><b>Matt</b></sub></a><br /></td>
|
||||
<td align="center"><a href="http://devco.net/"><img src="https://avatars0.githubusercontent.com/u/82342?v=4" width="48px;" alt=""/><br /><sub><b>R.I.Pienaar</b></sub></a><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="https://github.com/fmotrifork"><img src="https://avatars3.githubusercontent.com/u/18327738?v=4" width="48px;" alt=""/><br /><sub><b>Frederik Mogensen</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/aeter"><img src="https://avatars0.githubusercontent.com/u/238607?v=4" width="48px;" alt=""/><br /><sub><b>aeter</b></sub></a><br /></td>
|
||||
<td align="center"><a href="http://timhwang21.gitbook.io"><img src="https://avatars3.githubusercontent.com/u/5831434?v=4" width="48px;" alt=""/><br /><sub><b>Tim Hwang</b></sub></a><br /></td>
|
||||
<td align="center"><a href="http://about.me/yingfan"><img src="https://avatars1.githubusercontent.com/u/10404961?v=4" width="48px;" alt=""/><br /><sub><b>Ying Fan Chong</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/MartinJohns"><img src="https://avatars1.githubusercontent.com/u/5269069?v=4" width="48px;" alt=""/><br /><sub><b>Martin Johns</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://www.jvt.me"><img src="https://avatars0.githubusercontent.com/u/3315059?v=4" width="48px;" alt=""/><br /><sub><b>Jamie Tanna</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/trimble"><img src="https://avatars3.githubusercontent.com/u/371317?v=4" width="48px;" alt=""/><br /><sub><b>Todd Trimble</b></sub></a><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="https://www.mitchellhanberg.com"><img src="https://avatars2.githubusercontent.com/u/5523984?v=4" width="48px;" alt=""/><br /><sub><b>Mitchell Hanberg</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://franga2000.com"><img src="https://avatars3.githubusercontent.com/u/3891092?v=4" width="48px;" alt=""/><br /><sub><b>Miha Frangež</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://blog.sahilister.in/"><img src="https://avatars0.githubusercontent.com/u/52946452?v=4" width="48px;" alt=""/><br /><sub><b>Sahil Dhiman</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://pzoo.netlify.app/"><img src="https://avatars2.githubusercontent.com/u/17727004?v=4" width="48px;" alt=""/><br /><sub><b>Pingzhou | 平舟</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/YuviGold"><img src="https://avatars0.githubusercontent.com/u/29873449?v=4" width="48px;" alt=""/><br /><sub><b>Yuval Goldberg</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/dabcoder"><img src="https://avatars3.githubusercontent.com/u/5034531?v=4" width="48px;" alt=""/><br /><sub><b>David Bouchare</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/stone"><img src="https://avatars3.githubusercontent.com/u/29077?v=4" width="48px;" alt=""/><br /><sub><b>Fredrik Steen</b></sub></a><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="https://github.com/zye1996"><img src="https://avatars2.githubusercontent.com/u/28901953?v=4" width="48px;" alt=""/><br /><sub><b>zye1996</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://github.com/pgaxatte"><img src="https://avatars.githubusercontent.com/u/30696904?v=4" width="48px;" alt=""/><br /><sub><b>Pierre Gaxatte</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://xntrik.wtf"><img src="https://avatars.githubusercontent.com/u/678260?v=4" width="48px;" alt=""/><br /><sub><b>Christian Frichot</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://lukas-kaemmerling.de"><img src="https://avatars.githubusercontent.com/u/4281581?v=4" width="48px;" alt=""/><br /><sub><b>Lukas Kämmerling</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://inetant.net/"><img src="https://avatars.githubusercontent.com/u/1765366?v=4" width="48px;" alt=""/><br /><sub><b>Antoine Meillet</b></sub></a><br /></td>
|
||||
<td align="center"><a href="https://www.patreon.com/cclauss"><img src="https://avatars.githubusercontent.com/u/3709715?v=4" width="48px;" alt=""/><br /><sub><b>Christian Clauss</b></sub></a><br /></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- markdownlint-enable -->
|
||||
<!-- prettier-ignore-end -->
|
||||
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
||||
|
||||
## Acknowledgments
|
||||
@ -122,8 +437,7 @@ Dependency management in WTF is handled by [Go modules](https://github.com/golan
|
||||
The inspiration for `WTF` came from Monica Dinculescu's
|
||||
[tiny-care-terminal](https://github.com/notwaldorf/tiny-care-terminal).
|
||||
|
||||
Many thanks to <a href="https://lendesk.com">Lendesk</a> for supporting this project by
|
||||
providing time to develop it.
|
||||
WTF is built atop [tcell](https://github.com/gdamore/tcell) and [tview](https://github.com/rivo/tview), fantastic projects both. WTF is built, packaged, and deployed via [GoReleaser](https://goreleaser.com).
|
||||
|
||||
<p align="center">
|
||||
<img src="./images/dude_wtf.png?raw=true" title="Dude WTF" width="251" height="201" />
|
||||
|
@ -18,5 +18,4 @@ wtf:
|
||||
left: 0
|
||||
height: 2
|
||||
width: 2
|
||||
refreshInterval: 30
|
||||
updateInterval: 15
|
||||
refreshInterval: 30
|
21
_sample_configs/dynamic_sizing.yml
Normal file
21
_sample_configs/dynamic_sizing.yml
Normal file
@ -0,0 +1,21 @@
|
||||
wtf:
|
||||
mods:
|
||||
battery:
|
||||
type: power
|
||||
title: "⚡️"
|
||||
enabled: true
|
||||
position:
|
||||
top: 0
|
||||
left: 0
|
||||
height: 1
|
||||
width: 1
|
||||
refreshInterval: 15
|
||||
security_info:
|
||||
type: security
|
||||
enabled: true
|
||||
position:
|
||||
top: 0
|
||||
left: 1
|
||||
height: 1
|
||||
width: 1
|
||||
refreshInterval: 3600
|
BIN
_sample_configs/kubernetes_config.png
Normal file
BIN
_sample_configs/kubernetes_config.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 278 KiB |
21
_sample_configs/kubernetes_config.yml
Normal file
21
_sample_configs/kubernetes_config.yml
Normal file
@ -0,0 +1,21 @@
|
||||
wtf:
|
||||
colors:
|
||||
border:
|
||||
focusable: darkslateblue
|
||||
focused: orange
|
||||
normal: gray
|
||||
grid:
|
||||
columns: [32, 32, 32, 32, 32, 32]
|
||||
rows: [10, 10, 10, 10, 10, 10]
|
||||
refreshInterval: 2
|
||||
mods:
|
||||
kubernetes:
|
||||
enabled: true
|
||||
kubeconfig: /Users/testuser/.kube/config
|
||||
namespaces: ["demo", "kube-system"]
|
||||
objects: ["nodes","deployments", "pods"]
|
||||
position:
|
||||
top: 0
|
||||
left: 0
|
||||
height: 6
|
||||
width: 3
|
@ -61,7 +61,7 @@ wtf:
|
||||
UTC: "Etc/UTC"
|
||||
Vancouver: "America/Vancouver"
|
||||
New_York: "America/New_York"
|
||||
Sao_Paolo: "America/Sao_Paulo"
|
||||
Sao_Paulo: "America/Sao_Paulo"
|
||||
Denver: "America/Denver"
|
||||
Iqaluit: "America/Iqaluit"
|
||||
Bahamas: "America/Nassau"
|
||||
@ -98,7 +98,7 @@ wtf:
|
||||
left: 0
|
||||
height: 2
|
||||
width: 1
|
||||
refreshInterval: 3600
|
||||
refreshInterval: 3600
|
||||
ip:
|
||||
type: ipinfo
|
||||
title: "My IP"
|
||||
@ -177,4 +177,4 @@ wtf:
|
||||
left: 1
|
||||
height: 1
|
||||
width: 3
|
||||
refreshInterval: 3600
|
||||
refreshInterval: 3600
|
||||
|
17
_sample_configs/small_config.yml
Normal file
17
_sample_configs/small_config.yml
Normal file
@ -0,0 +1,17 @@
|
||||
wtf:
|
||||
grid:
|
||||
columns: [20, 20]
|
||||
rows: [3, 3]
|
||||
refreshInterval: 1
|
||||
mods:
|
||||
uptime:
|
||||
type: cmdrunner
|
||||
args: [""]
|
||||
cmd: "uptime"
|
||||
enabled: true
|
||||
position:
|
||||
top: 0
|
||||
left: 0
|
||||
height: 1
|
||||
width: 1
|
||||
refreshInterval: 30
|
71
app/app_manager.go
Normal file
71
app/app_manager.go
Normal file
@ -0,0 +1,71 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/olebedev/config"
|
||||
"github.com/rivo/tview"
|
||||
)
|
||||
|
||||
// WtfAppManager handles the instances of WtfApp, ensuring that they're displayed as requested
|
||||
type WtfAppManager struct {
|
||||
WtfApps []*WtfApp
|
||||
|
||||
selected int
|
||||
}
|
||||
|
||||
// NewAppManager creates and returns an instance of AppManager
|
||||
func NewAppManager() WtfAppManager {
|
||||
appMan := WtfAppManager{
|
||||
WtfApps: []*WtfApp{},
|
||||
}
|
||||
|
||||
return appMan
|
||||
}
|
||||
|
||||
// MakeNewWtfApp creates and starts a new instance of WtfApp from a set of configuration params
|
||||
func (appMan *WtfAppManager) MakeNewWtfApp(config *config.Config, configFilePath string) {
|
||||
wtfApp := NewWtfApp(tview.NewApplication(), config, configFilePath)
|
||||
appMan.Add(wtfApp)
|
||||
|
||||
wtfApp.Start()
|
||||
}
|
||||
|
||||
// Add adds a WtfApp to the collection of apps that the AppManager manages.
|
||||
// This app is then available for display onscreen.
|
||||
func (appMan *WtfAppManager) Add(wtfApp *WtfApp) {
|
||||
appMan.WtfApps = append(appMan.WtfApps, wtfApp)
|
||||
}
|
||||
|
||||
// Current returns the currently-displaying instance of WtfApp
|
||||
func (appMan *WtfAppManager) Current() (*WtfApp, error) {
|
||||
if appMan.selected < 0 || appMan.selected >= len(appMan.WtfApps) {
|
||||
return nil, errors.New("invalid app index selected")
|
||||
}
|
||||
|
||||
return appMan.WtfApps[appMan.selected], nil
|
||||
}
|
||||
|
||||
// Next cycles the WtfApps forward by one, making the next one in the list
|
||||
// the current one. If there are none after the current one, it wraps around.
|
||||
func (appMan *WtfAppManager) Next() (*WtfApp, error) {
|
||||
appMan.selected++
|
||||
|
||||
if appMan.selected >= len(appMan.WtfApps) {
|
||||
appMan.selected = 0
|
||||
}
|
||||
|
||||
return appMan.Current()
|
||||
}
|
||||
|
||||
// Prev cycles the WtfApps backwards by one, making the previous one in the
|
||||
// list the current one. If there are none before the current one, it wraps around.
|
||||
func (appMan *WtfAppManager) Prev() (*WtfApp, error) {
|
||||
appMan.selected--
|
||||
|
||||
if appMan.selected < 0 {
|
||||
appMan.selected = len(appMan.WtfApps) - 1
|
||||
}
|
||||
|
||||
return appMan.Current()
|
||||
}
|
67
app/display.go
Normal file
67
app/display.go
Normal file
@ -0,0 +1,67 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"github.com/olebedev/config"
|
||||
"github.com/rivo/tview"
|
||||
"github.com/wtfutil/wtf/utils"
|
||||
"github.com/wtfutil/wtf/wtf"
|
||||
)
|
||||
|
||||
// Display is the container for the onscreen representation of a WtfApp
|
||||
type Display struct {
|
||||
Grid *tview.Grid
|
||||
config *config.Config
|
||||
}
|
||||
|
||||
// NewDisplay creates and returns a Display
|
||||
func NewDisplay(widgets []wtf.Wtfable, config *config.Config) *Display {
|
||||
display := Display{
|
||||
Grid: tview.NewGrid(),
|
||||
config: config,
|
||||
}
|
||||
|
||||
firstWidget := widgets[0]
|
||||
display.Grid.SetBackgroundColor(
|
||||
wtf.ColorFor(
|
||||
firstWidget.CommonSettings().Colors.WidgetTheme.Background,
|
||||
),
|
||||
)
|
||||
|
||||
display.build(widgets)
|
||||
|
||||
return &display
|
||||
}
|
||||
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
|
||||
func (display *Display) add(widget wtf.Wtfable) {
|
||||
if widget.Disabled() {
|
||||
return
|
||||
}
|
||||
|
||||
display.Grid.AddItem(
|
||||
widget.TextView(),
|
||||
widget.CommonSettings().Top,
|
||||
widget.CommonSettings().Left,
|
||||
widget.CommonSettings().Height,
|
||||
widget.CommonSettings().Width,
|
||||
0,
|
||||
0,
|
||||
false,
|
||||
)
|
||||
}
|
||||
|
||||
func (display *Display) build(widgets []wtf.Wtfable) *tview.Grid {
|
||||
cols := utils.ToInts(display.config.UList("wtf.grid.columns"))
|
||||
rows := utils.ToInts(display.config.UList("wtf.grid.rows"))
|
||||
|
||||
display.Grid.SetColumns(cols...)
|
||||
display.Grid.SetRows(rows...)
|
||||
display.Grid.SetBorder(false)
|
||||
|
||||
for _, widget := range widgets {
|
||||
display.add(widget)
|
||||
}
|
||||
|
||||
return display.Grid
|
||||
}
|
104
app/exit_message.go
Normal file
104
app/exit_message.go
Normal file
@ -0,0 +1,104 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/logrusorgru/aurora"
|
||||
"github.com/olebedev/config"
|
||||
)
|
||||
|
||||
const exitMessageHeader = `
|
||||
____ __ ____ .___________. _______
|
||||
\ \ / \ / / | || ____|
|
||||
\ \/ \/ / ----| |-----| |__
|
||||
\ / | | | __|
|
||||
\ /\ / | | | |
|
||||
\__/ \__/ |__| |__|
|
||||
|
||||
the personal information dashboard for your terminal
|
||||
`
|
||||
|
||||
// DisplayExitMessage displays the onscreen exit message when the app quits
|
||||
func (wtfApp *WtfApp) DisplayExitMessage() {
|
||||
exitMessageIsDisplayable := readDisplayableConfig(wtfApp.config)
|
||||
|
||||
wtfApp.displayExitMsg(exitMessageIsDisplayable)
|
||||
}
|
||||
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
|
||||
func (wtfApp *WtfApp) displayExitMsg(exitMessageIsDisplayable bool) string {
|
||||
// If a sponsor or contributor and opt out of seeing the exit message, do not display it
|
||||
if (wtfApp.ghUser.IsContributor || wtfApp.ghUser.IsSponsor) && !exitMessageIsDisplayable {
|
||||
return ""
|
||||
}
|
||||
|
||||
msgs := []string{}
|
||||
|
||||
msgs = append(msgs, aurora.Magenta(exitMessageHeader).String())
|
||||
|
||||
if wtfApp.ghUser.IsContributor {
|
||||
msgs = append(msgs, wtfApp.contributorThankYouMessage())
|
||||
}
|
||||
|
||||
if wtfApp.ghUser.IsSponsor {
|
||||
msgs = append(msgs, wtfApp.sponsorThankYouMessage())
|
||||
}
|
||||
|
||||
if !wtfApp.ghUser.IsContributor && !wtfApp.ghUser.IsSponsor {
|
||||
msgs = append(msgs, wtfApp.supportRequestMessage())
|
||||
}
|
||||
|
||||
displayMsg := strings.Join(msgs, "\n")
|
||||
|
||||
fmt.Println(displayMsg)
|
||||
|
||||
return displayMsg
|
||||
}
|
||||
|
||||
// readDisplayableConfig figures out whether or not the exit message should be displayed
|
||||
// per the user's wishes. It allows contributors and sponsors to opt out of the exit message
|
||||
func readDisplayableConfig(cfg *config.Config) bool {
|
||||
displayExitMsg := cfg.UBool("wtf.exitMessage.display", true)
|
||||
return displayExitMsg
|
||||
}
|
||||
|
||||
// readGitHubAPIKey attempts to find a GitHub API key somewhere in the configuration file
|
||||
func readGitHubAPIKey(cfg *config.Config) string {
|
||||
apiKey := cfg.UString("wtf.exitMessage.githubAPIKey", os.Getenv("WTF_GITHUB_TOKEN"))
|
||||
if apiKey != "" {
|
||||
return apiKey
|
||||
}
|
||||
|
||||
moduleConfig, err := cfg.Get("wtf.mods.github")
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
|
||||
return moduleConfig.UString("apiKey", "")
|
||||
}
|
||||
|
||||
/* -------------------- Messaging -------------------- */
|
||||
|
||||
func (wtfApp *WtfApp) contributorThankYouMessage() string {
|
||||
str := " On behalf of all the users of WTF, thank you for contributing to the source code."
|
||||
str += fmt.Sprintf(" %s", aurora.Green("\n\n You rock."))
|
||||
|
||||
return str
|
||||
}
|
||||
|
||||
func (wtfApp *WtfApp) sponsorThankYouMessage() string {
|
||||
str := " Your sponsorship of WTF makes a difference. Thank you for sponsoring and supporting WTF."
|
||||
str += fmt.Sprintf(" %s", aurora.Green("\n\n You're awesome."))
|
||||
|
||||
return str
|
||||
}
|
||||
|
||||
func (wtfApp *WtfApp) supportRequestMessage() string {
|
||||
str := " The development and maintenance of WTF is supported by sponsorships.\n"
|
||||
str += fmt.Sprintf(" Please consider sponsoring WTF at %s\n", aurora.Green("https://github.com/sponsors/senorprogrammer"))
|
||||
|
||||
return str
|
||||
}
|
71
app/exit_message_test.go
Normal file
71
app/exit_message_test.go
Normal file
@ -0,0 +1,71 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/wtfutil/wtf/support"
|
||||
"gotest.tools/assert"
|
||||
)
|
||||
|
||||
func Test_displayExitMessage(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
isDisplayable bool
|
||||
isContributor bool
|
||||
isSponsor bool
|
||||
compareWith string
|
||||
expected string
|
||||
}{
|
||||
{
|
||||
name: "when not displayable",
|
||||
isDisplayable: false,
|
||||
isContributor: true,
|
||||
isSponsor: true,
|
||||
compareWith: "equals",
|
||||
expected: "",
|
||||
},
|
||||
{
|
||||
name: "when contributor",
|
||||
isDisplayable: true,
|
||||
isContributor: true,
|
||||
compareWith: "contains",
|
||||
expected: "thank you for contributing",
|
||||
},
|
||||
{
|
||||
name: "when sponsor",
|
||||
isDisplayable: true,
|
||||
isSponsor: true,
|
||||
compareWith: "contains",
|
||||
expected: "Thank you for sponsoring",
|
||||
},
|
||||
{
|
||||
name: "when user",
|
||||
isDisplayable: true,
|
||||
isContributor: false,
|
||||
isSponsor: false,
|
||||
compareWith: "contains",
|
||||
expected: "supported by sponsorships",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
wtfApp := WtfApp{}
|
||||
wtfApp.ghUser = &support.GitHubUser{
|
||||
IsContributor: tt.isContributor,
|
||||
IsSponsor: tt.isSponsor,
|
||||
}
|
||||
|
||||
actual := wtfApp.displayExitMsg(tt.isDisplayable)
|
||||
|
||||
if tt.compareWith == "equals" {
|
||||
assert.Equal(t, actual, tt.expected)
|
||||
}
|
||||
|
||||
if tt.compareWith == "contains" {
|
||||
assert.Equal(t, true, strings.Contains(actual, tt.expected))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
@ -1,12 +1,15 @@
|
||||
package wtf
|
||||
package app
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sort"
|
||||
|
||||
"github.com/olebedev/config"
|
||||
"github.com/rivo/tview"
|
||||
"github.com/wtfutil/wtf/wtf"
|
||||
)
|
||||
|
||||
// FocusState is a custom type that differentiates focusable scopes
|
||||
type FocusState int
|
||||
|
||||
const (
|
||||
@ -18,17 +21,18 @@ const (
|
||||
// FocusTracker is used by the app to track which onscreen widget currently has focus,
|
||||
// and to move focus between widgets.
|
||||
type FocusTracker struct {
|
||||
App *tview.Application
|
||||
Idx int
|
||||
IsFocused bool
|
||||
Widgets []Wtfable
|
||||
Widgets []wtf.Wtfable
|
||||
|
||||
config *config.Config
|
||||
config *config.Config
|
||||
tviewApp *tview.Application
|
||||
}
|
||||
|
||||
func NewFocusTracker(app *tview.Application, widgets []Wtfable, config *config.Config) FocusTracker {
|
||||
// NewFocusTracker creates and returns an instance of FocusTracker
|
||||
func NewFocusTracker(tviewApp *tview.Application, widgets []wtf.Wtfable, config *config.Config) FocusTracker {
|
||||
focusTracker := FocusTracker{
|
||||
App: app,
|
||||
tviewApp: tviewApp,
|
||||
Idx: -1,
|
||||
IsFocused: false,
|
||||
Widgets: widgets,
|
||||
@ -43,6 +47,7 @@ func NewFocusTracker(app *tview.Application, widgets []Wtfable, config *config.C
|
||||
|
||||
/* -------------------- Exported Functions -------------------- */
|
||||
|
||||
// FocusOn puts the focus on the item that belongs to the focus character passed in
|
||||
func (tracker *FocusTracker) FocusOn(char string) bool {
|
||||
if !tracker.useNavShortcuts() {
|
||||
return false
|
||||
@ -106,6 +111,7 @@ func (tracker *FocusTracker) Prev() {
|
||||
tracker.IsFocused = true
|
||||
}
|
||||
|
||||
// Refocus forces the focus back to the currently-selected item
|
||||
func (tracker *FocusTracker) Refocus() {
|
||||
tracker.focus(tracker.Idx)
|
||||
}
|
||||
@ -114,6 +120,7 @@ func (tracker *FocusTracker) Refocus() {
|
||||
|
||||
// AssignHotKeys assigns an alphabetic keyboard character to each focusable
|
||||
// widget so that the widget can be brought into focus by pressing that keyboard key
|
||||
// Valid numbers are between 1 and 9, inclusive
|
||||
func (tracker *FocusTracker) assignHotKeys() {
|
||||
if !tracker.useNavShortcuts() {
|
||||
return
|
||||
@ -121,30 +128,37 @@ func (tracker *FocusTracker) assignHotKeys() {
|
||||
|
||||
usedKeys := make(map[string]bool)
|
||||
focusables := tracker.focusables()
|
||||
i := 1
|
||||
|
||||
// First, block out the explicitly-defined characters so they can't be automatically
|
||||
// assigned to other modules
|
||||
for _, focusable := range focusables {
|
||||
if focusable.FocusChar() != "" {
|
||||
usedKeys[focusable.FocusChar()] = true
|
||||
}
|
||||
}
|
||||
|
||||
focusNum := 1
|
||||
|
||||
// Range over all the modules and assign focus characters to any that are focusable
|
||||
// and don't have explicitly-defined focus characters
|
||||
for _, focusable := range focusables {
|
||||
if focusable.FocusChar() != "" {
|
||||
continue
|
||||
}
|
||||
if _, foundKey := usedKeys[string('0'+i)]; foundKey {
|
||||
for ; foundKey; _, foundKey = usedKeys[string('0'+i)] {
|
||||
i++
|
||||
|
||||
if _, foundKey := usedKeys[fmt.Sprint(focusNum)]; foundKey {
|
||||
for ; foundKey; _, foundKey = usedKeys[fmt.Sprint(focusNum)] {
|
||||
focusNum++
|
||||
}
|
||||
}
|
||||
|
||||
// Don't have nav characters > "9"
|
||||
if i >= 10 {
|
||||
// Don't allow focus characters > "9"
|
||||
if focusNum >= 10 {
|
||||
break
|
||||
}
|
||||
|
||||
focusable.SetFocusChar(string('0' + i))
|
||||
i++
|
||||
focusable.SetFocusChar(fmt.Sprint(focusNum))
|
||||
focusNum++
|
||||
}
|
||||
}
|
||||
|
||||
@ -157,7 +171,11 @@ func (tracker *FocusTracker) blur(idx int) {
|
||||
view := widget.TextView()
|
||||
view.Blur()
|
||||
|
||||
view.SetBorderColor(ColorFor(widget.BorderColor()))
|
||||
view.SetBorderColor(
|
||||
wtf.ColorFor(
|
||||
widget.BorderColor(),
|
||||
),
|
||||
)
|
||||
|
||||
tracker.IsFocused = false
|
||||
}
|
||||
@ -177,12 +195,16 @@ func (tracker *FocusTracker) focus(idx int) {
|
||||
}
|
||||
|
||||
view := widget.TextView()
|
||||
view.SetBorderColor(ColorFor(tracker.config.UString("wtf.colors.border.focused", "gray")))
|
||||
tracker.App.SetFocus(view)
|
||||
view.SetBorderColor(
|
||||
wtf.ColorFor(
|
||||
widget.CommonSettings().Colors.BorderTheme.Focused,
|
||||
),
|
||||
)
|
||||
tracker.tviewApp.SetFocus(view)
|
||||
}
|
||||
|
||||
func (tracker *FocusTracker) focusables() []Wtfable {
|
||||
focusable := []Wtfable{}
|
||||
func (tracker *FocusTracker) focusables() []wtf.Wtfable {
|
||||
focusable := []wtf.Wtfable{}
|
||||
|
||||
for _, widget := range tracker.Widgets {
|
||||
if widget.Focusable() {
|
||||
@ -191,12 +213,15 @@ func (tracker *FocusTracker) focusables() []Wtfable {
|
||||
}
|
||||
|
||||
// Sort for deterministic ordering
|
||||
sort.SliceStable(focusable[:], func(i, j int) bool {
|
||||
if focusable[i].Top() < focusable[j].Top() {
|
||||
sort.SliceStable(focusable, func(i, j int) bool {
|
||||
iTop := focusable[i].CommonSettings().Top
|
||||
jTop := focusable[j].CommonSettings().Top
|
||||
|
||||
if iTop < jTop {
|
||||
return true
|
||||
}
|
||||
if focusable[i].Top() == focusable[j].Top() {
|
||||
return focusable[i].Left() < focusable[j].Left()
|
||||
if iTop == jTop {
|
||||
return focusable[i].CommonSettings().Left < focusable[j].CommonSettings().Left
|
||||
}
|
||||
return false
|
||||
})
|
||||
@ -204,7 +229,7 @@ func (tracker *FocusTracker) focusables() []Wtfable {
|
||||
return focusable
|
||||
}
|
||||
|
||||
func (tracker *FocusTracker) focusableAt(idx int) Wtfable {
|
||||
func (tracker *FocusTracker) focusableAt(idx int) wtf.Wtfable {
|
||||
if idx < 0 || idx >= len(tracker.focusables()) {
|
||||
return nil
|
||||
}
|
||||
@ -218,7 +243,7 @@ func (tracker *FocusTracker) focusState() FocusState {
|
||||
}
|
||||
|
||||
for _, widget := range tracker.Widgets {
|
||||
if widget.TextView() == tracker.App.GetFocus() {
|
||||
if widget.TextView() == tracker.tviewApp.GetFocus() {
|
||||
return widgetFocused
|
||||
}
|
||||
}
|
81
app/module_validator.go
Normal file
81
app/module_validator.go
Normal file
@ -0,0 +1,81 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/logrusorgru/aurora"
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
"github.com/wtfutil/wtf/wtf"
|
||||
)
|
||||
|
||||
// ModuleValidator is responsible for validating the state of a module's configuration
|
||||
type ModuleValidator struct{}
|
||||
|
||||
type widgetError struct {
|
||||
name string
|
||||
validationErrors []cfg.Validatable
|
||||
}
|
||||
|
||||
// NewModuleValidator creates and returns an instance of ModuleValidator
|
||||
func NewModuleValidator() *ModuleValidator {
|
||||
return &ModuleValidator{}
|
||||
}
|
||||
|
||||
// Validate rolls through all the enabled widgets and looks for configuration errors.
|
||||
// If it finds any it stringifies them, writes them to the console, and kills the app gracefully
|
||||
func (val *ModuleValidator) Validate(widgets []wtf.Wtfable) {
|
||||
validationErrors := validate(widgets)
|
||||
|
||||
if len(validationErrors) > 0 {
|
||||
fmt.Println()
|
||||
for _, error := range validationErrors {
|
||||
for _, message := range error.errorMessages() {
|
||||
fmt.Println(message)
|
||||
}
|
||||
}
|
||||
fmt.Println()
|
||||
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
func validate(widgets []wtf.Wtfable) (widgetErrors []widgetError) {
|
||||
for _, widget := range widgets {
|
||||
error := widgetError{name: widget.Name()}
|
||||
|
||||
for _, val := range widget.CommonSettings().Validations() {
|
||||
if val.HasError() {
|
||||
error.validationErrors = append(error.validationErrors, val)
|
||||
}
|
||||
}
|
||||
|
||||
if len(error.validationErrors) > 0 {
|
||||
widgetErrors = append(widgetErrors, error)
|
||||
}
|
||||
}
|
||||
|
||||
return widgetErrors
|
||||
}
|
||||
|
||||
func (err widgetError) errorMessages() (messages []string) {
|
||||
widgetMessage := fmt.Sprintf(
|
||||
"%s in %s configuration",
|
||||
aurora.Red("Errors"),
|
||||
aurora.Yellow(
|
||||
fmt.Sprintf(
|
||||
"%s.position",
|
||||
err.name,
|
||||
),
|
||||
),
|
||||
)
|
||||
messages = append(messages, widgetMessage)
|
||||
|
||||
for _, e := range err.validationErrors {
|
||||
configMessage := fmt.Sprintf(" - %s\t%s %v", e.String(), aurora.Red("Error:"), e.Error())
|
||||
|
||||
messages = append(messages, configMessage)
|
||||
}
|
||||
|
||||
return messages
|
||||
}
|
102
app/module_validator_test.go
Normal file
102
app/module_validator_test.go
Normal file
@ -0,0 +1,102 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/logrusorgru/aurora"
|
||||
"github.com/olebedev/config"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/wtfutil/wtf/wtf"
|
||||
)
|
||||
|
||||
const (
|
||||
valid = `
|
||||
wtf:
|
||||
mods:
|
||||
clocks:
|
||||
enabled: true
|
||||
position:
|
||||
top: 0
|
||||
left: 0
|
||||
height: 1
|
||||
width: 1
|
||||
refreshInterval: 30`
|
||||
|
||||
invalid = `
|
||||
wtf:
|
||||
mods:
|
||||
clocks:
|
||||
enabled: true
|
||||
position:
|
||||
top: abc
|
||||
left: 0
|
||||
height: 1
|
||||
width: 1
|
||||
refreshInterval: 30`
|
||||
)
|
||||
|
||||
func Test_NewModuleValidator(t *testing.T) {
|
||||
assert.IsType(t, &ModuleValidator{}, NewModuleValidator())
|
||||
}
|
||||
|
||||
func Test_validate(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
moduleName string
|
||||
config *config.Config
|
||||
expected []string
|
||||
}{
|
||||
{
|
||||
name: "valid config",
|
||||
moduleName: "clocks",
|
||||
config: func() *config.Config {
|
||||
cfg, _ := config.ParseYaml(valid)
|
||||
return cfg
|
||||
}(),
|
||||
expected: []string{},
|
||||
},
|
||||
{
|
||||
name: "invalid config",
|
||||
moduleName: "clocks",
|
||||
config: func() *config.Config {
|
||||
cfg, _ := config.ParseYaml(invalid)
|
||||
return cfg
|
||||
}(),
|
||||
expected: []string{
|
||||
fmt.Sprintf("%s in %s configuration", aurora.Red("Errors"), aurora.Yellow("clocks.position")),
|
||||
fmt.Sprintf(
|
||||
" - Invalid value for %s: 0 %s strconv.ParseInt: parsing \"abc\": invalid syntax",
|
||||
aurora.Yellow("top"),
|
||||
aurora.Red("Error:"),
|
||||
),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
widget := MakeWidget(nil, nil, tt.moduleName, tt.config)
|
||||
|
||||
if widget == nil {
|
||||
t.Logf("Failed to create widget %s", tt.moduleName)
|
||||
t.FailNow()
|
||||
}
|
||||
|
||||
errs := validate([]wtf.Wtfable{widget})
|
||||
|
||||
if len(tt.expected) == 0 {
|
||||
assert.Empty(t, errs)
|
||||
} else {
|
||||
assert.NotEmpty(t, errs)
|
||||
|
||||
var actual []string
|
||||
for _, err := range errs {
|
||||
actual = append(actual, err.errorMessages()...)
|
||||
}
|
||||
|
||||
assert.Equal(t, tt.expected, actual)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
38
app/scheduler.go
Normal file
38
app/scheduler.go
Normal file
@ -0,0 +1,38 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/wtfutil/wtf/wtf"
|
||||
)
|
||||
|
||||
// Schedule kicks off the first refresh of a module's data and then queues the rest of the
|
||||
// data refreshes on a timer
|
||||
func Schedule(widget wtf.Wtfable) {
|
||||
widget.Refresh()
|
||||
|
||||
interval := time.Duration(widget.RefreshInterval()) * time.Second
|
||||
|
||||
if interval <= 0 {
|
||||
return
|
||||
}
|
||||
|
||||
timer := time.NewTicker(interval)
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-timer.C:
|
||||
if widget.Enabled() {
|
||||
widget.Refresh()
|
||||
} else {
|
||||
timer.Stop()
|
||||
return
|
||||
}
|
||||
case quit := <-widget.QuitChan():
|
||||
if quit {
|
||||
timer.Stop()
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
362
app/widget_maker.go
Normal file
362
app/widget_maker.go
Normal file
@ -0,0 +1,362 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"github.com/olebedev/config"
|
||||
"github.com/rivo/tview"
|
||||
"github.com/wtfutil/wtf/modules/asana"
|
||||
"github.com/wtfutil/wtf/modules/azuredevops"
|
||||
"github.com/wtfutil/wtf/modules/bamboohr"
|
||||
"github.com/wtfutil/wtf/modules/bargraph"
|
||||
"github.com/wtfutil/wtf/modules/buildkite"
|
||||
cdsfavorites "github.com/wtfutil/wtf/modules/cds/favorites"
|
||||
cdsqueue "github.com/wtfutil/wtf/modules/cds/queue"
|
||||
cdsstatus "github.com/wtfutil/wtf/modules/cds/status"
|
||||
"github.com/wtfutil/wtf/modules/circleci"
|
||||
"github.com/wtfutil/wtf/modules/clocks"
|
||||
"github.com/wtfutil/wtf/modules/cmdrunner"
|
||||
"github.com/wtfutil/wtf/modules/covid"
|
||||
"github.com/wtfutil/wtf/modules/cryptoexchanges/bittrex"
|
||||
"github.com/wtfutil/wtf/modules/cryptoexchanges/blockfolio"
|
||||
"github.com/wtfutil/wtf/modules/cryptoexchanges/cryptolive"
|
||||
"github.com/wtfutil/wtf/modules/datadog"
|
||||
"github.com/wtfutil/wtf/modules/devto"
|
||||
"github.com/wtfutil/wtf/modules/digitalclock"
|
||||
"github.com/wtfutil/wtf/modules/digitalocean"
|
||||
"github.com/wtfutil/wtf/modules/docker"
|
||||
"github.com/wtfutil/wtf/modules/exchangerates"
|
||||
"github.com/wtfutil/wtf/modules/feedreader"
|
||||
"github.com/wtfutil/wtf/modules/football"
|
||||
"github.com/wtfutil/wtf/modules/gcal"
|
||||
"github.com/wtfutil/wtf/modules/gerrit"
|
||||
"github.com/wtfutil/wtf/modules/git"
|
||||
"github.com/wtfutil/wtf/modules/github"
|
||||
"github.com/wtfutil/wtf/modules/gitlab"
|
||||
"github.com/wtfutil/wtf/modules/gitlabtodo"
|
||||
"github.com/wtfutil/wtf/modules/gitter"
|
||||
"github.com/wtfutil/wtf/modules/googleanalytics"
|
||||
"github.com/wtfutil/wtf/modules/grafana"
|
||||
"github.com/wtfutil/wtf/modules/gspreadsheets"
|
||||
"github.com/wtfutil/wtf/modules/hackernews"
|
||||
"github.com/wtfutil/wtf/modules/healthchecks"
|
||||
"github.com/wtfutil/wtf/modules/hibp"
|
||||
"github.com/wtfutil/wtf/modules/ipaddresses/ipapi"
|
||||
"github.com/wtfutil/wtf/modules/ipaddresses/ipinfo"
|
||||
"github.com/wtfutil/wtf/modules/jenkins"
|
||||
"github.com/wtfutil/wtf/modules/jira"
|
||||
"github.com/wtfutil/wtf/modules/krisinformation"
|
||||
"github.com/wtfutil/wtf/modules/kubernetes"
|
||||
"github.com/wtfutil/wtf/modules/logger"
|
||||
"github.com/wtfutil/wtf/modules/mercurial"
|
||||
"github.com/wtfutil/wtf/modules/nbascore"
|
||||
"github.com/wtfutil/wtf/modules/newrelic"
|
||||
"github.com/wtfutil/wtf/modules/opsgenie"
|
||||
"github.com/wtfutil/wtf/modules/pagerduty"
|
||||
"github.com/wtfutil/wtf/modules/pihole"
|
||||
"github.com/wtfutil/wtf/modules/pocket"
|
||||
"github.com/wtfutil/wtf/modules/power"
|
||||
"github.com/wtfutil/wtf/modules/resourceusage"
|
||||
"github.com/wtfutil/wtf/modules/rollbar"
|
||||
"github.com/wtfutil/wtf/modules/security"
|
||||
"github.com/wtfutil/wtf/modules/spacex"
|
||||
"github.com/wtfutil/wtf/modules/spotify"
|
||||
"github.com/wtfutil/wtf/modules/spotifyweb"
|
||||
"github.com/wtfutil/wtf/modules/status"
|
||||
"github.com/wtfutil/wtf/modules/stocks/finnhub"
|
||||
"github.com/wtfutil/wtf/modules/stocks/yfinance"
|
||||
"github.com/wtfutil/wtf/modules/subreddit"
|
||||
"github.com/wtfutil/wtf/modules/textfile"
|
||||
"github.com/wtfutil/wtf/modules/todo"
|
||||
"github.com/wtfutil/wtf/modules/todo_plus"
|
||||
"github.com/wtfutil/wtf/modules/transmission"
|
||||
"github.com/wtfutil/wtf/modules/travisci"
|
||||
"github.com/wtfutil/wtf/modules/twitch"
|
||||
"github.com/wtfutil/wtf/modules/twitter"
|
||||
"github.com/wtfutil/wtf/modules/twitterstats"
|
||||
"github.com/wtfutil/wtf/modules/unknown"
|
||||
"github.com/wtfutil/wtf/modules/uptimerobot"
|
||||
"github.com/wtfutil/wtf/modules/victorops"
|
||||
"github.com/wtfutil/wtf/modules/weatherservices/arpansagovau"
|
||||
"github.com/wtfutil/wtf/modules/weatherservices/prettyweather"
|
||||
"github.com/wtfutil/wtf/modules/weatherservices/weather"
|
||||
"github.com/wtfutil/wtf/modules/zendesk"
|
||||
"github.com/wtfutil/wtf/wtf"
|
||||
)
|
||||
|
||||
// MakeWidget creates and returns instances of widgets
|
||||
func MakeWidget(
|
||||
tviewApp *tview.Application,
|
||||
pages *tview.Pages,
|
||||
moduleName string,
|
||||
config *config.Config,
|
||||
) wtf.Wtfable {
|
||||
var widget wtf.Wtfable
|
||||
|
||||
moduleConfig, _ := config.Get("wtf.mods." + moduleName)
|
||||
|
||||
// Don' try to initialize modules that don't exist
|
||||
if moduleConfig == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Don't try to initialize modules that aren't enabled
|
||||
if enabled := moduleConfig.UBool("enabled", false); !enabled {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Always in alphabetical order
|
||||
switch moduleConfig.UString("type", moduleName) {
|
||||
case "arpansagovau":
|
||||
settings := arpansagovau.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = arpansagovau.NewWidget(tviewApp, settings)
|
||||
case "asana":
|
||||
settings := asana.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = asana.NewWidget(tviewApp, pages, settings)
|
||||
case "azuredevops":
|
||||
settings := azuredevops.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = azuredevops.NewWidget(tviewApp, pages, settings)
|
||||
case "bamboohr":
|
||||
settings := bamboohr.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = bamboohr.NewWidget(tviewApp, settings)
|
||||
case "bargraph":
|
||||
settings := bargraph.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = bargraph.NewWidget(tviewApp, settings)
|
||||
case "bittrex":
|
||||
settings := bittrex.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = bittrex.NewWidget(tviewApp, settings)
|
||||
case "blockfolio":
|
||||
settings := blockfolio.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = blockfolio.NewWidget(tviewApp, settings)
|
||||
case "buildkite":
|
||||
settings := buildkite.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = buildkite.NewWidget(tviewApp, pages, settings)
|
||||
case "cdsFavorites":
|
||||
settings := cdsfavorites.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = cdsfavorites.NewWidget(tviewApp, pages, settings)
|
||||
case "cdsQueue":
|
||||
settings := cdsqueue.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = cdsqueue.NewWidget(tviewApp, pages, settings)
|
||||
case "cdsStatus":
|
||||
settings := cdsstatus.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = cdsstatus.NewWidget(tviewApp, pages, settings)
|
||||
case "circleci":
|
||||
settings := circleci.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = circleci.NewWidget(tviewApp, settings)
|
||||
case "clocks":
|
||||
settings := clocks.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = clocks.NewWidget(tviewApp, settings)
|
||||
case "covid":
|
||||
settings := covid.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = covid.NewWidget(tviewApp, settings)
|
||||
case "cmdrunner":
|
||||
settings := cmdrunner.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = cmdrunner.NewWidget(tviewApp, settings)
|
||||
case "cryptolive":
|
||||
settings := cryptolive.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = cryptolive.NewWidget(tviewApp, settings)
|
||||
case "datadog":
|
||||
settings := datadog.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = datadog.NewWidget(tviewApp, pages, settings)
|
||||
case "devto":
|
||||
settings := devto.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = devto.NewWidget(tviewApp, pages, settings)
|
||||
case "digitalclock":
|
||||
settings := digitalclock.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = digitalclock.NewWidget(tviewApp, settings)
|
||||
case "digitalocean":
|
||||
settings := digitalocean.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = digitalocean.NewWidget(tviewApp, pages, settings)
|
||||
case "docker":
|
||||
settings := docker.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = docker.NewWidget(tviewApp, pages, settings)
|
||||
case "feedreader":
|
||||
settings := feedreader.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = feedreader.NewWidget(tviewApp, pages, settings)
|
||||
case "football":
|
||||
settings := football.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = football.NewWidget(tviewApp, pages, settings)
|
||||
case "gcal":
|
||||
settings := gcal.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = gcal.NewWidget(tviewApp, settings)
|
||||
case "gerrit":
|
||||
settings := gerrit.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = gerrit.NewWidget(tviewApp, pages, settings)
|
||||
case "git":
|
||||
settings := git.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = git.NewWidget(tviewApp, pages, settings)
|
||||
case "github":
|
||||
settings := github.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = github.NewWidget(tviewApp, pages, settings)
|
||||
case "gitlab":
|
||||
settings := gitlab.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = gitlab.NewWidget(tviewApp, pages, settings)
|
||||
case "gitlabtodo":
|
||||
settings := gitlabtodo.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = gitlabtodo.NewWidget(tviewApp, pages, settings)
|
||||
case "gitter":
|
||||
settings := gitter.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = gitter.NewWidget(tviewApp, pages, settings)
|
||||
case "googleanalytics":
|
||||
settings := googleanalytics.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = googleanalytics.NewWidget(tviewApp, settings)
|
||||
case "gspreadsheets":
|
||||
settings := gspreadsheets.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = gspreadsheets.NewWidget(tviewApp, settings)
|
||||
case "grafana":
|
||||
settings := grafana.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = grafana.NewWidget(tviewApp, pages, settings)
|
||||
case "hackernews":
|
||||
settings := hackernews.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = hackernews.NewWidget(tviewApp, pages, settings)
|
||||
case "healthchecks":
|
||||
settings := healthchecks.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = healthchecks.NewWidget(tviewApp, pages, settings)
|
||||
case "hibp":
|
||||
settings := hibp.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = hibp.NewWidget(tviewApp, settings)
|
||||
case "ipapi":
|
||||
settings := ipapi.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = ipapi.NewWidget(tviewApp, settings)
|
||||
case "ipinfo":
|
||||
settings := ipinfo.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = ipinfo.NewWidget(tviewApp, settings)
|
||||
case "jenkins":
|
||||
settings := jenkins.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = jenkins.NewWidget(tviewApp, pages, settings)
|
||||
case "jira":
|
||||
settings := jira.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = jira.NewWidget(tviewApp, pages, settings)
|
||||
case "kubernetes":
|
||||
settings := kubernetes.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = kubernetes.NewWidget(tviewApp, settings)
|
||||
case "krisinformation":
|
||||
settings := krisinformation.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = krisinformation.NewWidget(tviewApp, settings)
|
||||
case "logger":
|
||||
settings := logger.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = logger.NewWidget(tviewApp, settings)
|
||||
case "mercurial":
|
||||
settings := mercurial.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = mercurial.NewWidget(tviewApp, pages, settings)
|
||||
case "nbascore":
|
||||
settings := nbascore.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = nbascore.NewWidget(tviewApp, pages, settings)
|
||||
case "newrelic":
|
||||
settings := newrelic.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = newrelic.NewWidget(tviewApp, pages, settings)
|
||||
case "opsgenie":
|
||||
settings := opsgenie.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = opsgenie.NewWidget(tviewApp, settings)
|
||||
case "pagerduty":
|
||||
settings := pagerduty.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = pagerduty.NewWidget(tviewApp, settings)
|
||||
case "pihole":
|
||||
settings := pihole.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = pihole.NewWidget(tviewApp, pages, settings)
|
||||
case "power":
|
||||
settings := power.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = power.NewWidget(tviewApp, settings)
|
||||
case "prettyweather":
|
||||
settings := prettyweather.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = prettyweather.NewWidget(tviewApp, settings)
|
||||
case "pocket":
|
||||
settings := pocket.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = pocket.NewWidget(tviewApp, pages, settings)
|
||||
case "resourceusage":
|
||||
settings := resourceusage.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = resourceusage.NewWidget(tviewApp, settings)
|
||||
case "rollbar":
|
||||
settings := rollbar.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = rollbar.NewWidget(tviewApp, pages, settings)
|
||||
case "security":
|
||||
settings := security.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = security.NewWidget(tviewApp, settings)
|
||||
case "spacex":
|
||||
settings := spacex.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = spacex.NewWidget(tviewApp, settings)
|
||||
case "spotify":
|
||||
settings := spotify.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = spotify.NewWidget(tviewApp, pages, settings)
|
||||
case "spotifyweb":
|
||||
settings := spotifyweb.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = spotifyweb.NewWidget(tviewApp, pages, settings)
|
||||
case "status":
|
||||
settings := status.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = status.NewWidget(tviewApp, settings)
|
||||
case "subreddit":
|
||||
settings := subreddit.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = subreddit.NewWidget(tviewApp, pages, settings)
|
||||
case "textfile":
|
||||
settings := textfile.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = textfile.NewWidget(tviewApp, pages, settings)
|
||||
case "todo":
|
||||
settings := todo.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = todo.NewWidget(tviewApp, pages, settings)
|
||||
case "todo_plus":
|
||||
settings := todo_plus.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = todo_plus.NewWidget(tviewApp, pages, settings)
|
||||
case "todoist":
|
||||
settings := todo_plus.FromTodoist(moduleName, moduleConfig, config)
|
||||
widget = todo_plus.NewWidget(tviewApp, pages, settings)
|
||||
case "transmission":
|
||||
settings := transmission.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = transmission.NewWidget(tviewApp, pages, settings)
|
||||
case "travisci":
|
||||
settings := travisci.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = travisci.NewWidget(tviewApp, pages, settings)
|
||||
case "trello":
|
||||
settings := todo_plus.FromTrello(moduleName, moduleConfig, config)
|
||||
widget = todo_plus.NewWidget(tviewApp, pages, settings)
|
||||
case "twitch":
|
||||
settings := twitch.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = twitch.NewWidget(tviewApp, pages, settings)
|
||||
case "twitter":
|
||||
settings := twitter.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = twitter.NewWidget(tviewApp, pages, settings)
|
||||
case "twitterstats":
|
||||
settings := twitterstats.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = twitterstats.NewWidget(tviewApp, pages, settings)
|
||||
case "uptimerobot":
|
||||
settings := uptimerobot.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = uptimerobot.NewWidget(tviewApp, pages, settings)
|
||||
case "victorops":
|
||||
settings := victorops.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = victorops.NewWidget(tviewApp, settings)
|
||||
case "weather":
|
||||
settings := weather.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = weather.NewWidget(tviewApp, pages, settings)
|
||||
case "zendesk":
|
||||
settings := zendesk.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = zendesk.NewWidget(tviewApp, pages, settings)
|
||||
case "exchangerates":
|
||||
settings := exchangerates.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = exchangerates.NewWidget(tviewApp, pages, settings)
|
||||
case "finnhub":
|
||||
settings := finnhub.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = finnhub.NewWidget(tviewApp, settings)
|
||||
case "yfinance":
|
||||
settings := yfinance.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = yfinance.NewWidget(tviewApp, settings)
|
||||
default:
|
||||
settings := unknown.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = unknown.NewWidget(tviewApp, settings)
|
||||
}
|
||||
|
||||
return widget
|
||||
}
|
||||
|
||||
// MakeWidgets creates and returns a collection of enabled widgets
|
||||
func MakeWidgets(tviewApp *tview.Application, pages *tview.Pages, config *config.Config) []wtf.Wtfable {
|
||||
widgets := []wtf.Wtfable{}
|
||||
|
||||
moduleNames, _ := config.Map("wtf.mods")
|
||||
|
||||
for moduleName := range moduleNames {
|
||||
widget := MakeWidget(tviewApp, pages, moduleName, config)
|
||||
|
||||
if widget != nil {
|
||||
widgets = append(widgets, widget)
|
||||
}
|
||||
}
|
||||
|
||||
return widgets
|
||||
}
|
77
app/widget_maker_test.go
Normal file
77
app/widget_maker_test.go
Normal file
@ -0,0 +1,77 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/olebedev/config"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/wtfutil/wtf/modules/clocks"
|
||||
"github.com/wtfutil/wtf/wtf"
|
||||
)
|
||||
|
||||
const (
|
||||
disabled = `
|
||||
wtf:
|
||||
mods:
|
||||
clocks:
|
||||
enabled: false
|
||||
position:
|
||||
top: 0
|
||||
left: 0
|
||||
height: 1
|
||||
width: 1
|
||||
refreshInterval: 30`
|
||||
|
||||
enabled = `
|
||||
wtf:
|
||||
mods:
|
||||
clocks:
|
||||
enabled: true
|
||||
position:
|
||||
top: 0
|
||||
left: 0
|
||||
height: 1
|
||||
width: 1
|
||||
refreshInterval: 30`
|
||||
)
|
||||
|
||||
func Test_MakeWidget(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
moduleName string
|
||||
config *config.Config
|
||||
expected wtf.Wtfable
|
||||
}{
|
||||
{
|
||||
name: "invalid module",
|
||||
moduleName: "",
|
||||
config: &config.Config{},
|
||||
expected: nil,
|
||||
},
|
||||
{
|
||||
name: "valid disabled module",
|
||||
moduleName: "clocks",
|
||||
config: func() *config.Config {
|
||||
cfg, _ := config.ParseYaml(disabled)
|
||||
return cfg
|
||||
}(),
|
||||
expected: nil,
|
||||
},
|
||||
{
|
||||
name: "valid enabled module",
|
||||
moduleName: "clocks",
|
||||
config: func() *config.Config {
|
||||
cfg, _ := config.ParseYaml(enabled)
|
||||
return cfg
|
||||
}(),
|
||||
expected: &clocks.Widget{},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
actual := MakeWidget(nil, nil, tt.moduleName, tt.config)
|
||||
assert.IsType(t, tt.expected, actual)
|
||||
})
|
||||
}
|
||||
}
|
201
app/wtf_app.go
Normal file
201
app/wtf_app.go
Normal file
@ -0,0 +1,201 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/gdamore/tcell"
|
||||
_ "github.com/gdamore/tcell/terminfo/extended"
|
||||
"github.com/logrusorgru/aurora"
|
||||
"github.com/olebedev/config"
|
||||
"github.com/radovskyb/watcher"
|
||||
"github.com/rivo/tview"
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
"github.com/wtfutil/wtf/support"
|
||||
"github.com/wtfutil/wtf/utils"
|
||||
"github.com/wtfutil/wtf/wtf"
|
||||
)
|
||||
|
||||
// WtfApp is the container for a collection of widgets that are all constructed from a single
|
||||
// configuration file and displayed together
|
||||
type WtfApp struct {
|
||||
TViewApp *tview.Application
|
||||
|
||||
config *config.Config
|
||||
configFilePath string
|
||||
display *Display
|
||||
focusTracker FocusTracker
|
||||
ghUser *support.GitHubUser
|
||||
pages *tview.Pages
|
||||
validator *ModuleValidator
|
||||
widgets []wtf.Wtfable
|
||||
}
|
||||
|
||||
// NewWtfApp creates and returns an instance of WtfApp
|
||||
func NewWtfApp(tviewApp *tview.Application, config *config.Config, configFilePath string) *WtfApp {
|
||||
wtfApp := &WtfApp{
|
||||
TViewApp: tviewApp,
|
||||
|
||||
config: config,
|
||||
configFilePath: configFilePath,
|
||||
pages: tview.NewPages(),
|
||||
}
|
||||
|
||||
wtfApp.TViewApp.SetBeforeDrawFunc(func(s tcell.Screen) bool {
|
||||
s.Clear()
|
||||
return false
|
||||
})
|
||||
|
||||
wtfApp.widgets = MakeWidgets(wtfApp.TViewApp, wtfApp.pages, wtfApp.config)
|
||||
wtfApp.display = NewDisplay(wtfApp.widgets, wtfApp.config)
|
||||
wtfApp.focusTracker = NewFocusTracker(wtfApp.TViewApp, wtfApp.widgets, wtfApp.config)
|
||||
wtfApp.validator = NewModuleValidator()
|
||||
|
||||
githubAPIKey := readGitHubAPIKey(wtfApp.config)
|
||||
wtfApp.ghUser = support.NewGitHubUser(githubAPIKey)
|
||||
|
||||
wtfApp.pages.AddPage("grid", wtfApp.display.Grid, true, true)
|
||||
|
||||
wtfApp.validator.Validate(wtfApp.widgets)
|
||||
|
||||
firstWidget := wtfApp.widgets[0]
|
||||
wtfApp.pages.Box.SetBackgroundColor(
|
||||
wtf.ColorFor(
|
||||
firstWidget.CommonSettings().Colors.WidgetTheme.Background,
|
||||
),
|
||||
)
|
||||
|
||||
wtfApp.TViewApp.SetInputCapture(wtfApp.keyboardIntercept)
|
||||
wtfApp.TViewApp.SetRoot(wtfApp.pages, true)
|
||||
|
||||
return wtfApp
|
||||
}
|
||||
|
||||
/* -------------------- Exported Functions -------------------- */
|
||||
|
||||
// Run starts the underlying tview app
|
||||
func (wtfApp *WtfApp) Run() {
|
||||
if err := wtfApp.TViewApp.Run(); err != nil {
|
||||
fmt.Printf("\n%s %v\n", aurora.Red("ERROR"), err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
// Start initializes the app
|
||||
func (wtfApp *WtfApp) Start() {
|
||||
go wtfApp.scheduleWidgets()
|
||||
go wtfApp.watchForConfigChanges()
|
||||
|
||||
// FIXME: This should be moved to the AppManager
|
||||
go func() { _ = wtfApp.ghUser.Load() }()
|
||||
}
|
||||
|
||||
// Stop kills all the currently-running widgets in this app
|
||||
func (wtfApp *WtfApp) Stop() {
|
||||
wtfApp.stopAllWidgets()
|
||||
}
|
||||
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
|
||||
func (wtfApp *WtfApp) stopAllWidgets() {
|
||||
for _, widget := range wtfApp.widgets {
|
||||
widget.Stop()
|
||||
}
|
||||
}
|
||||
|
||||
func (wtfApp *WtfApp) keyboardIntercept(event *tcell.EventKey) *tcell.EventKey {
|
||||
// These keys are global keys used by the app. Widgets should not implement these keys
|
||||
switch event.Key() {
|
||||
case tcell.KeyCtrlC:
|
||||
wtfApp.Stop()
|
||||
wtfApp.TViewApp.Stop()
|
||||
wtfApp.DisplayExitMessage()
|
||||
case tcell.KeyCtrlR:
|
||||
wtfApp.refreshAllWidgets()
|
||||
return nil
|
||||
case tcell.KeyCtrlSpace:
|
||||
// FIXME: This can't reside in the app, the app doesn't know about
|
||||
// the AppManager. The AppManager needs to catch this one
|
||||
fmt.Println("Next app")
|
||||
return nil
|
||||
case tcell.KeyTab:
|
||||
wtfApp.focusTracker.Next()
|
||||
case tcell.KeyBacktab:
|
||||
wtfApp.focusTracker.Prev()
|
||||
return nil
|
||||
case tcell.KeyEsc:
|
||||
wtfApp.focusTracker.None()
|
||||
}
|
||||
|
||||
// Checks to see if any widget has been assigned the pressed key as its focus key
|
||||
if wtfApp.focusTracker.FocusOn(string(event.Rune())) {
|
||||
return nil
|
||||
}
|
||||
|
||||
// If no specific widget has focus, then allow the key presses to fall through to the app
|
||||
if !wtfApp.focusTracker.IsFocused {
|
||||
switch string(event.Rune()) {
|
||||
case "/":
|
||||
return nil
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
return event
|
||||
}
|
||||
|
||||
func (wtfApp *WtfApp) refreshAllWidgets() {
|
||||
for _, widget := range wtfApp.widgets {
|
||||
go widget.Refresh()
|
||||
}
|
||||
}
|
||||
|
||||
func (wtfApp *WtfApp) scheduleWidgets() {
|
||||
for _, widget := range wtfApp.widgets {
|
||||
go Schedule(widget)
|
||||
}
|
||||
}
|
||||
|
||||
func (wtfApp *WtfApp) watchForConfigChanges() {
|
||||
watch := watcher.New()
|
||||
|
||||
// Notify write events
|
||||
watch.FilterOps(watcher.Write)
|
||||
|
||||
go func() {
|
||||
for {
|
||||
select {
|
||||
case <-watch.Event:
|
||||
wtfApp.Stop()
|
||||
|
||||
config := cfg.LoadWtfConfigFile(wtfApp.configFilePath)
|
||||
newApp := NewWtfApp(wtfApp.TViewApp, config, wtfApp.configFilePath)
|
||||
openURLUtil := utils.ToStrs(config.UList("wtf.openUrlUtil", []interface{}{}))
|
||||
utils.Init(config.UString("wtf.openFileUtil", "open"), openURLUtil)
|
||||
|
||||
newApp.Start()
|
||||
case err := <-watch.Error:
|
||||
if err == watcher.ErrWatchedFileDeleted {
|
||||
// Usually happens because the watcher looks for the file as the OS is updating it
|
||||
continue
|
||||
}
|
||||
log.Fatalln(err)
|
||||
case <-watch.Closed:
|
||||
return
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
// Watch config file for changes.
|
||||
absPath, _ := utils.ExpandHomeDir(wtfApp.configFilePath)
|
||||
if err := watch.Add(absPath); err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
// Start the watching process - it'll check for changes every 100ms.
|
||||
if err := watch.Start(time.Millisecond * 100); err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
}
|
@ -5,38 +5,19 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/olebedev/config"
|
||||
"golang.org/x/text/language"
|
||||
"golang.org/x/text/message"
|
||||
)
|
||||
|
||||
type Colors struct {
|
||||
Background string
|
||||
BorderFocusable string
|
||||
BorderFocused string
|
||||
BorderNormal string
|
||||
Checked string
|
||||
Foreground string
|
||||
HighlightFore string
|
||||
HighlightBack string
|
||||
Text string
|
||||
Title string
|
||||
|
||||
Rows struct {
|
||||
Even string
|
||||
Odd string
|
||||
}
|
||||
}
|
||||
const (
|
||||
defaultLanguageTag = "en-CA"
|
||||
)
|
||||
|
||||
type Module struct {
|
||||
Name string
|
||||
Type string
|
||||
}
|
||||
|
||||
type Position struct {
|
||||
Height int
|
||||
Left int
|
||||
Top int
|
||||
Width int
|
||||
}
|
||||
|
||||
type Sigils struct {
|
||||
Checkbox struct {
|
||||
Checked string
|
||||
@ -48,94 +29,146 @@ type Sigils struct {
|
||||
}
|
||||
}
|
||||
|
||||
// Common defines a set of common configuration settings applicable to all modules
|
||||
type Common struct {
|
||||
Colors
|
||||
Module
|
||||
Position `help:"Defines where in the grid this module’s widget will be displayed."`
|
||||
PositionSettings `help:"Defines where in the grid this module’s widget will be displayed."`
|
||||
Sigils
|
||||
|
||||
Enabled bool `help:"Determines whether or not this module is executed and if its data displayed onscreen." values:"true, false"`
|
||||
RefreshInterval int `help:"How often, in seconds, this module will update its data." values:"A positive integer, 0..n." optional:"true"`
|
||||
Title string
|
||||
Config *config.Config
|
||||
Colors ColorTheme
|
||||
Config *config.Config
|
||||
|
||||
DocPath string
|
||||
|
||||
Bordered bool `help:"Whether or not the module should be displayed with a border." values:"true, false" optional:"true" default:"true"`
|
||||
Enabled bool `help:"Whether or not this module is executed and if its data displayed onscreen." values:"true, false" optional:"true" default:"false"`
|
||||
Focusable bool `help:"Whether or not this module is focusable." values:"true, false" optional:"true" default:"false"`
|
||||
LanguageTag string `help:"The BCP 47 langauge tag to localize text to." values:"Any supported BCP 47 language tag." optional:"true" default:"en-CA"`
|
||||
RefreshInterval int `help:"How often, in seconds, this module will update its data." values:"A positive integer, 0..n." optional:"true"`
|
||||
Title string `help:"The title string to show when displaying this module" optional:"true"`
|
||||
|
||||
focusChar int `help:"Define one of the number keys as a short cut key to access the widget." optional:"true"`
|
||||
}
|
||||
|
||||
func NewCommonSettingsFromModule(name, defaultTitle string, moduleConfig *config.Config, globalSettings *config.Config) *Common {
|
||||
colorsConfig, _ := globalSettings.Get("wtf.colors")
|
||||
positionPath := "position"
|
||||
sigilsPath := "wtf.sigils"
|
||||
// NewCommonSettingsFromModule returns a common settings configuration tailed to the given module
|
||||
func NewCommonSettingsFromModule(name, defaultTitle string, defaultFocusable bool, moduleConfig *config.Config, globalConfig *config.Config) *Common {
|
||||
baseColors := NewDefaultColorTheme()
|
||||
|
||||
colorsConfig, err := globalConfig.Get("wtf.colors")
|
||||
if err != nil && strings.Contains(err.Error(), "Nonexistent map") {
|
||||
// Create a default colors config to fill in for the missing one
|
||||
// This comes into play when the configuration file does not contain a `colors:` key, i.e:
|
||||
//
|
||||
// wtf:
|
||||
// # colors: <- missing
|
||||
// refreshInterval: 1
|
||||
// openFileUtil: "open"
|
||||
//
|
||||
colorsConfig, _ = NewDefaultColorConfig()
|
||||
}
|
||||
|
||||
// And finally create a third instance to be the final default fallback in case there are empty or nil values in
|
||||
// the colors extracted from the config file (aka colorsConfig)
|
||||
defaultColorTheme := NewDefaultColorTheme()
|
||||
|
||||
baseColors.BorderTheme.Focusable = moduleConfig.UString("colors.border.focusable", colorsConfig.UString("border.focusable", defaultColorTheme.BorderTheme.Focusable))
|
||||
baseColors.BorderTheme.Focused = moduleConfig.UString("colors.border.focused", colorsConfig.UString("border.focused", defaultColorTheme.BorderTheme.Focused))
|
||||
baseColors.BorderTheme.Unfocusable = moduleConfig.UString("colors.border.normal", colorsConfig.UString("border.normal", defaultColorTheme.BorderTheme.Unfocusable))
|
||||
|
||||
baseColors.CheckboxTheme.Checked = moduleConfig.UString("colors.checked", colorsConfig.UString("checked", defaultColorTheme.CheckboxTheme.Checked))
|
||||
|
||||
baseColors.RowTheme.EvenForeground = moduleConfig.UString("colors.rows.even", colorsConfig.UString("rows.even", defaultColorTheme.RowTheme.EvenForeground))
|
||||
baseColors.RowTheme.OddForeground = moduleConfig.UString("colors.rows.odd", colorsConfig.UString("rows.odd", defaultColorTheme.RowTheme.OddForeground))
|
||||
|
||||
baseColors.TextTheme.Label = moduleConfig.UString("colors.label", colorsConfig.UString("label", defaultColorTheme.TextTheme.Label))
|
||||
baseColors.TextTheme.Subheading = moduleConfig.UString("colors.subheading", colorsConfig.UString("subheading", defaultColorTheme.TextTheme.Subheading))
|
||||
baseColors.TextTheme.Text = moduleConfig.UString("colors.text", colorsConfig.UString("text", defaultColorTheme.TextTheme.Text))
|
||||
baseColors.TextTheme.Title = moduleConfig.UString("colors.title", colorsConfig.UString("title", defaultColorTheme.TextTheme.Title))
|
||||
|
||||
baseColors.WidgetTheme.Background = moduleConfig.UString("colors.background", colorsConfig.UString("background", defaultColorTheme.WidgetTheme.Background))
|
||||
|
||||
common := Common{
|
||||
Colors: Colors{
|
||||
Background: moduleConfig.UString("background", globalSettings.UString("background", "black")),
|
||||
BorderFocusable: colorsConfig.UString("border.focusable", "red"),
|
||||
BorderFocused: colorsConfig.UString("border.focused", "orange"),
|
||||
BorderNormal: colorsConfig.UString("border.normal", "gray"),
|
||||
Checked: colorsConfig.UString("checked", "white"),
|
||||
Foreground: moduleConfig.UString("foreground", colorsConfig.UString("foreground", "white")),
|
||||
HighlightFore: colorsConfig.UString("highlight.fore", "black"),
|
||||
HighlightBack: colorsConfig.UString("highlight.back", "green"),
|
||||
Text: moduleConfig.UString("colors.text", colorsConfig.UString("text", "white")),
|
||||
Title: moduleConfig.UString("colors.title", colorsConfig.UString("title", "white")),
|
||||
},
|
||||
Colors: baseColors,
|
||||
|
||||
Module: Module{
|
||||
Name: name,
|
||||
Type: moduleConfig.UString("type", name),
|
||||
},
|
||||
|
||||
Position: Position{
|
||||
Height: moduleConfig.UInt(positionPath + ".height"),
|
||||
Left: moduleConfig.UInt(positionPath + ".left"),
|
||||
Top: moduleConfig.UInt(positionPath + ".top"),
|
||||
Width: moduleConfig.UInt(positionPath + ".width"),
|
||||
},
|
||||
PositionSettings: NewPositionSettingsFromYAML(name, moduleConfig),
|
||||
|
||||
Bordered: moduleConfig.UBool("border", true),
|
||||
Config: moduleConfig,
|
||||
Enabled: moduleConfig.UBool("enabled", false),
|
||||
Focusable: moduleConfig.UBool("focusable", defaultFocusable),
|
||||
LanguageTag: globalConfig.UString("wtf.language", defaultLanguageTag),
|
||||
RefreshInterval: moduleConfig.UInt("refreshInterval", 300),
|
||||
Title: moduleConfig.UString("title", defaultTitle),
|
||||
Config: moduleConfig,
|
||||
|
||||
focusChar: moduleConfig.UInt("focusChar", -1),
|
||||
}
|
||||
|
||||
common.Colors.Rows.Even = moduleConfig.UString("colors.rows.even", moduleConfig.UString("rows.even", "white"))
|
||||
common.Colors.Rows.Odd = moduleConfig.UString("colors.rows.even", moduleConfig.UString("rows.odd", "lightblue"))
|
||||
|
||||
common.Sigils.Checkbox.Checked = globalSettings.UString(sigilsPath+".checkbox.checked", "x")
|
||||
common.Sigils.Checkbox.Unchecked = globalSettings.UString(sigilsPath+".checkbox.unchecked", " ")
|
||||
|
||||
common.Sigils.Paging.Normal = globalSettings.UString(sigilsPath+".paging.normal", globalSettings.UString("wtf.paging.pageSigil", "*"))
|
||||
common.Sigils.Paging.Selected = globalSettings.UString(sigilsPath+".paging.select", globalSettings.UString("wtf.paging.selectedSigil", "_"))
|
||||
sigilsPath := "wtf.sigils"
|
||||
common.Sigils.Checkbox.Checked = globalConfig.UString(sigilsPath+".checkbox.checked", "x")
|
||||
common.Sigils.Checkbox.Unchecked = globalConfig.UString(sigilsPath+".checkbox.unchecked", " ")
|
||||
common.Sigils.Paging.Normal = globalConfig.UString(sigilsPath+".paging.normal", globalConfig.UString("wtf.paging.pageSigil", "*"))
|
||||
common.Sigils.Paging.Selected = globalConfig.UString(sigilsPath+".paging.select", globalConfig.UString("wtf.paging.selectedSigil", "_"))
|
||||
|
||||
return &common
|
||||
}
|
||||
|
||||
func (common *Common) DefaultFocussedRowColor() string {
|
||||
return fmt.Sprintf("%s:%s", common.Colors.HighlightFore, common.Colors.HighlightBack)
|
||||
/* -------------------- Exported Functions -------------------- */
|
||||
|
||||
func (common *Common) DefaultFocusedRowColor() string {
|
||||
return fmt.Sprintf(
|
||||
"%s:%s",
|
||||
common.Colors.RowTheme.HighlightedForeground,
|
||||
common.Colors.RowTheme.HighlightedBackground,
|
||||
)
|
||||
}
|
||||
|
||||
func (common *Common) DefaultRowColor() string {
|
||||
return fmt.Sprintf("%s:%s", common.Colors.Foreground, common.Colors.Background)
|
||||
return fmt.Sprintf(
|
||||
"%s:%s",
|
||||
common.Colors.RowTheme.EvenForeground,
|
||||
common.Colors.RowTheme.EvenBackground,
|
||||
)
|
||||
}
|
||||
|
||||
// FocusChar returns the keyboard number assigned to the widget used to give onscreen
|
||||
// focus to this widget, as a string. Focus characters can be a range between 1 and 9
|
||||
func (common *Common) FocusChar() string {
|
||||
focusChar := string('0' + common.focusChar)
|
||||
if common.focusChar == -1 {
|
||||
focusChar = ""
|
||||
if common.focusChar <= 0 {
|
||||
return ""
|
||||
}
|
||||
|
||||
return focusChar
|
||||
if common.focusChar > 9 {
|
||||
return ""
|
||||
}
|
||||
|
||||
return fmt.Sprint(common.focusChar)
|
||||
}
|
||||
|
||||
// LocalizedPrinter returns a message.Printer instance localized to the BCP 47 language
|
||||
// configuration value defined in 'wtf.language' config. If none exists, it defaults to
|
||||
// 'en-CA'. Use this to format numbers, etc.
|
||||
func (common *Common) LocalizedPrinter() (*message.Printer, error) {
|
||||
langTag, err := language.Parse(common.LanguageTag)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
prntr := message.NewPrinter(langTag)
|
||||
|
||||
return prntr, nil
|
||||
}
|
||||
|
||||
func (common *Common) RowColor(idx int) string {
|
||||
if idx%2 == 0 {
|
||||
return common.Colors.Rows.Even
|
||||
return common.Colors.RowTheme.EvenForeground
|
||||
}
|
||||
|
||||
return common.Colors.Rows.Odd
|
||||
return common.Colors.RowTheme.OddForeground
|
||||
}
|
||||
|
||||
func (common *Common) RightAlignFormat(width int) string {
|
||||
@ -143,7 +176,9 @@ func (common *Common) RightAlignFormat(width int) string {
|
||||
return fmt.Sprintf("%%%ds", width-borderOffset)
|
||||
}
|
||||
|
||||
func (common *Common) SigilStr(len, pos int, width int) string {
|
||||
// PaginationMarker generates the pagination indicators that appear in the top-right corner
|
||||
// of multisource widgets
|
||||
func (common *Common) PaginationMarker(len, pos, width int) string {
|
||||
sigils := ""
|
||||
|
||||
if len > 1 {
|
||||
@ -156,3 +191,24 @@ func (common *Common) SigilStr(len, pos int, width int) string {
|
||||
|
||||
return sigils
|
||||
}
|
||||
|
||||
// SetDocumentationPath is used to explicitly set the documentation path that should be opened
|
||||
// when the key to open the documentation is pressed.
|
||||
// Setting this is probably not necessary unless the module documentation is nested inside a
|
||||
// documentation subdirectory in the /wtfutildocs repo, or the module here has a different
|
||||
// name than the module's display name in the documentation (which ideally wouldn't be a thing).
|
||||
func (common *Common) SetDocumentationPath(path string) {
|
||||
common.DocPath = path
|
||||
}
|
||||
|
||||
// Validations aggregates all the validations from all the sub-sections in Common into a
|
||||
// single array of validations
|
||||
func (common *Common) Validations() []Validatable {
|
||||
validatables := []Validatable{}
|
||||
|
||||
for _, validation := range common.PositionSettings.Validations.validations {
|
||||
validatables = append(validatables, validation)
|
||||
}
|
||||
|
||||
return validatables
|
||||
}
|
||||
|
194
cfg/common_settings_test.go
Normal file
194
cfg/common_settings_test.go
Normal file
@ -0,0 +1,194 @@
|
||||
package cfg
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/olebedev/config"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
var (
|
||||
testYaml = `
|
||||
wtf:
|
||||
colors:
|
||||
`
|
||||
|
||||
moduleConfig, _ = config.ParseYaml(testYaml)
|
||||
globalSettings, _ = config.ParseYaml(testYaml)
|
||||
|
||||
testCfg = NewCommonSettingsFromModule(
|
||||
"test",
|
||||
"Test Config",
|
||||
true,
|
||||
moduleConfig,
|
||||
globalSettings,
|
||||
)
|
||||
)
|
||||
|
||||
func Test_NewCommonSettingsFromModule(t *testing.T) {
|
||||
assert.Equal(t, true, testCfg.Bordered)
|
||||
assert.Equal(t, false, testCfg.Enabled)
|
||||
assert.Equal(t, true, testCfg.Focusable)
|
||||
assert.Equal(t, "test", testCfg.Module.Name)
|
||||
assert.Equal(t, "test", testCfg.Module.Type)
|
||||
assert.Equal(t, "", testCfg.FocusChar())
|
||||
assert.Equal(t, 300, testCfg.RefreshInterval)
|
||||
assert.Equal(t, "Test Config", testCfg.Title)
|
||||
}
|
||||
|
||||
func Test_DefaultFocusedRowColor(t *testing.T) {
|
||||
assert.Equal(t, "black:green", testCfg.DefaultFocusedRowColor())
|
||||
}
|
||||
|
||||
func Test_DefaultRowColor(t *testing.T) {
|
||||
assert.Equal(t, "white:transparent", testCfg.DefaultRowColor())
|
||||
}
|
||||
|
||||
func Test_FocusChar(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
before func(testCfg *Common)
|
||||
expectedChar string
|
||||
}{
|
||||
{
|
||||
name: "with negative focus char",
|
||||
before: func(testCfg *Common) {
|
||||
testCfg.focusChar = -1
|
||||
},
|
||||
expectedChar: "",
|
||||
},
|
||||
{
|
||||
name: "with positive focus char",
|
||||
before: func(testCfg *Common) {
|
||||
testCfg.focusChar = 3
|
||||
},
|
||||
expectedChar: "3",
|
||||
},
|
||||
{
|
||||
name: "with zero focus char",
|
||||
before: func(testCfg *Common) {
|
||||
testCfg.focusChar = 0
|
||||
},
|
||||
expectedChar: "",
|
||||
},
|
||||
{
|
||||
name: "with large focus char",
|
||||
before: func(testCfg *Common) {
|
||||
testCfg.focusChar = 10
|
||||
},
|
||||
expectedChar: "",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
tt.before(testCfg)
|
||||
|
||||
assert.Equal(t, tt.expectedChar, testCfg.FocusChar())
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func Test_RowColor(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
idx int
|
||||
expectedColor string
|
||||
}{
|
||||
{
|
||||
name: "odd rows, default",
|
||||
idx: 3,
|
||||
expectedColor: "lightblue",
|
||||
},
|
||||
{
|
||||
name: "even rows, default",
|
||||
idx: 8,
|
||||
expectedColor: "white",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
assert.Equal(t, tt.expectedColor, testCfg.RowColor(tt.idx))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func Test_RightAlignFormat(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
width int
|
||||
expected string
|
||||
}{
|
||||
{
|
||||
name: "with zero",
|
||||
width: 0,
|
||||
expected: "%-2s",
|
||||
},
|
||||
{
|
||||
name: "with positive integer",
|
||||
width: 3,
|
||||
expected: "%1s",
|
||||
},
|
||||
{
|
||||
name: "with negative integer",
|
||||
width: -3,
|
||||
expected: "%-5s",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
assert.Equal(t, tt.expected, testCfg.RightAlignFormat(tt.width))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func Test_PaginationMarker(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
len int
|
||||
pos int
|
||||
width int
|
||||
expected string
|
||||
}{
|
||||
{
|
||||
name: "with zero pages",
|
||||
len: 0,
|
||||
pos: 1,
|
||||
width: 5,
|
||||
expected: "",
|
||||
},
|
||||
{
|
||||
name: "with one page",
|
||||
len: 1,
|
||||
pos: 1,
|
||||
width: 5,
|
||||
expected: "",
|
||||
},
|
||||
{
|
||||
name: "with multiple pages",
|
||||
len: 3,
|
||||
pos: 1,
|
||||
width: 5,
|
||||
expected: "[lightblue]*_*[white]",
|
||||
},
|
||||
{
|
||||
name: "with negative pages",
|
||||
len: -3,
|
||||
pos: 1,
|
||||
width: 5,
|
||||
expected: "",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
assert.Equal(t, tt.expected, testCfg.PaginationMarker(tt.len, tt.pos, tt.width))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func Test_Validations(t *testing.T) {
|
||||
assert.Equal(t, 4, len(testCfg.Validations()))
|
||||
}
|
@ -11,98 +11,33 @@ import (
|
||||
"github.com/olebedev/config"
|
||||
)
|
||||
|
||||
// ConfigDirV1 defines the path to the first version of configuration. Do not use this
|
||||
const ConfigDirV1 = "~/.wtf/"
|
||||
const (
|
||||
// XdgConfigDir defines the path to the minimal XDG-compatible configuration directory
|
||||
XdgConfigDir = "~/.config/"
|
||||
|
||||
// ConfigDirV2 defines the path to the second version of the configuration. Use this.
|
||||
const ConfigDirV2 = "~/.config/wtf/"
|
||||
// WtfConfigDirV1 defines the path to the first version of configuration. Do not use this
|
||||
WtfConfigDirV1 = "~/.wtf/"
|
||||
|
||||
/* -------------------- Config Migration -------------------- */
|
||||
// WtfConfigDirV2 defines the path to the second version of the configuration. Use this.
|
||||
WtfConfigDirV2 = "~/.config/wtf/"
|
||||
|
||||
// MigrateOldConfig copies any existing configuration from the old location
|
||||
// to the new, XDG-compatible location
|
||||
func MigrateOldConfig() {
|
||||
srcDir, _ := expandHomeDir(ConfigDirV1)
|
||||
destDir, _ := expandHomeDir(ConfigDirV2)
|
||||
// WtfConfigFile defines the name of the default config file
|
||||
WtfConfigFile = "config.yml"
|
||||
)
|
||||
|
||||
// If the old config directory doesn't exist, do not move
|
||||
if _, err := os.Stat(srcDir); os.IsNotExist(err) {
|
||||
return
|
||||
}
|
||||
|
||||
// If the new config directory already exists, do not move
|
||||
if _, err := os.Stat(destDir); err == nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Time to move
|
||||
err := Copy(srcDir, destDir)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// Delete the old directory if the new one exists
|
||||
if _, err := os.Stat(destDir); err == nil {
|
||||
err := os.RemoveAll(srcDir)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------- Config Migration -------------------- */
|
||||
|
||||
// ConfigDir returns the absolute path to the configuration directory
|
||||
func ConfigDir() (string, error) {
|
||||
configDir, err := expandHomeDir(ConfigDirV2)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return configDir, nil
|
||||
}
|
||||
|
||||
// CreateConfigDir creates the wtf/ directory in the user's home dir
|
||||
func CreateConfigDir() {
|
||||
configDir, _ := ConfigDir()
|
||||
|
||||
if _, err := os.Stat(configDir); os.IsNotExist(err) {
|
||||
err := os.Mkdir(configDir, os.ModePerm)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// CreateConfigFile creates a simple config file in the config directory if
|
||||
// one does not already exist
|
||||
func CreateConfigFile() {
|
||||
filePath, err := CreateFile("config.yml")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// If the file is empty, write to it
|
||||
file, _ := os.Stat(filePath)
|
||||
|
||||
if file.Size() == 0 {
|
||||
if ioutil.WriteFile(filePath, []byte(simpleConfig), 0644) != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
/* -------------------- Exported Functions -------------------- */
|
||||
|
||||
// CreateFile creates the named file in the config directory, if it does not already exist.
|
||||
// If the file exists it does not recreate it.
|
||||
// If successful, eturns the absolute path to the file
|
||||
// If successful, returns the absolute path to the file
|
||||
// If unsuccessful, returns an error
|
||||
func CreateFile(fileName string) (string, error) {
|
||||
configDir, err := ConfigDir()
|
||||
configDir, err := WtfConfigDir()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
filePath := fmt.Sprintf("%s/%s", configDir, fileName)
|
||||
filePath := filepath.Join(configDir, fileName)
|
||||
|
||||
// Check if the file already exists; if it does not, create it
|
||||
_, err = os.Stat(filePath)
|
||||
@ -120,87 +55,105 @@ func CreateFile(fileName string) (string, error) {
|
||||
return filePath, nil
|
||||
}
|
||||
|
||||
// LoadConfigFile loads the config.yml file to configure the app
|
||||
func LoadConfigFile(filePath string) *config.Config {
|
||||
// Initialize takes care of settings up the initial state of WTF configuration
|
||||
// It ensures necessary directories and files exist
|
||||
func Initialize(hasCustom bool) {
|
||||
if !hasCustom {
|
||||
migrateOldConfig()
|
||||
}
|
||||
|
||||
// These always get created because this is where modules should write any permanent
|
||||
// data they need to persist between runs (i.e.: log, textfile, etc.)
|
||||
createWtfConfigDir()
|
||||
|
||||
if !hasCustom {
|
||||
createWtfConfigFile()
|
||||
chmodConfigFile()
|
||||
}
|
||||
}
|
||||
|
||||
// WtfConfigDir returns the absolute path to the configuration directory
|
||||
func WtfConfigDir() (string, error) {
|
||||
configDir := os.Getenv("XDG_CONFIG_HOME")
|
||||
if configDir == "" {
|
||||
configDir = WtfConfigDirV2
|
||||
} else {
|
||||
configDir += "/wtf/"
|
||||
}
|
||||
configDir, err := expandHomeDir(configDir)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return configDir, nil
|
||||
}
|
||||
|
||||
// LoadWtfConfigFile loads the specified config file
|
||||
func LoadWtfConfigFile(filePath string) *config.Config {
|
||||
absPath, _ := expandHomeDir(filePath)
|
||||
|
||||
cfg, err := config.ParseYamlFile(absPath)
|
||||
if err != nil {
|
||||
fmt.Println("\n\n\033[1m ERROR:\033[0m Could not load '\033[0;33mconfig.yml\033[0m'.\n Please add a \033[0;33mconfig.yml\033[0m file to your \033[0;33m~/.config/wtf\033[0m directory.\n See \033[1;34mhttps://github.com/wtfutil/wtf\033[0m for details.")
|
||||
fmt.Printf(" %s\n", err.Error())
|
||||
displayWtfConfigFileLoadError(absPath, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
return cfg
|
||||
}
|
||||
|
||||
const simpleConfig = `wtf:
|
||||
colors:
|
||||
border:
|
||||
focusable: darkslateblue
|
||||
focused: orange
|
||||
normal: gray
|
||||
grid:
|
||||
columns: [40, 40]
|
||||
rows: [13, 13, 4]
|
||||
refreshInterval: 1
|
||||
mods:
|
||||
clocks:
|
||||
colors:
|
||||
rows:
|
||||
even: "lightblue"
|
||||
odd: "white"
|
||||
enabled: true
|
||||
locations:
|
||||
Avignon: "Europe/Paris"
|
||||
Barcelona: "Europe/Madrid"
|
||||
Dubai: "Asia/Dubai"
|
||||
Vancouver: "America/Vancouver"
|
||||
Toronto: "America/Toronto"
|
||||
position:
|
||||
top: 0
|
||||
left: 0
|
||||
height: 1
|
||||
width: 1
|
||||
refreshInterval: 15
|
||||
sort: "alphabetical"
|
||||
security:
|
||||
enabled: true
|
||||
position:
|
||||
top: 1
|
||||
left: 0
|
||||
height: 1
|
||||
width: 1
|
||||
refreshInterval: 3600
|
||||
status:
|
||||
enabled: true
|
||||
position:
|
||||
top: 2
|
||||
left: 0
|
||||
height: 1
|
||||
width: 2
|
||||
refreshInterval: 1
|
||||
system:
|
||||
enabled: true
|
||||
position:
|
||||
top: 0
|
||||
left: 1
|
||||
height: 1
|
||||
width: 1
|
||||
refreshInterval: 3600
|
||||
textfile:
|
||||
enabled: true
|
||||
filePath: "~/.config/wtf/config.yml"
|
||||
position:
|
||||
top: 1
|
||||
left: 1
|
||||
height: 1
|
||||
width: 1
|
||||
refreshInterval: 30
|
||||
`
|
||||
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
|
||||
// chmodConfigFile sets the mode of the config file to r+w for the owner only
|
||||
func chmodConfigFile() {
|
||||
configDir, _ := WtfConfigDir()
|
||||
relPath := filepath.Join(configDir, WtfConfigFile)
|
||||
absPath, _ := expandHomeDir(relPath)
|
||||
|
||||
_, err := os.Stat(absPath)
|
||||
if err != nil && os.IsNotExist(err) {
|
||||
return
|
||||
}
|
||||
|
||||
err = os.Chmod(absPath, 0600)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// createWtfConfigDir creates the necessary directories for storing the default config file
|
||||
// If ~/.config/wtf is missing, it will try to create it
|
||||
func createWtfConfigDir() {
|
||||
wtfConfigDir, _ := WtfConfigDir()
|
||||
|
||||
if _, err := os.Stat(wtfConfigDir); os.IsNotExist(err) {
|
||||
err := os.MkdirAll(wtfConfigDir, os.ModePerm)
|
||||
if err != nil {
|
||||
displayWtfConfigDirCreateError(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// createWtfConfigFile creates a simple config file in the config directory if
|
||||
// one does not already exist
|
||||
func createWtfConfigFile() {
|
||||
filePath, err := CreateFile(WtfConfigFile)
|
||||
if err != nil {
|
||||
displayDefaultConfigCreateError(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// If the file is empty, write to it
|
||||
file, _ := os.Stat(filePath)
|
||||
|
||||
if file.Size() == 0 {
|
||||
if ioutil.WriteFile(filePath, []byte(defaultConfigFile), 0600) != nil {
|
||||
displayDefaultConfigWriteError(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Expand expands the path to include the home directory if the path
|
||||
// is prefixed with `~`. If it isn't prefixed with `~`, the path is
|
||||
// returned as-is.
|
||||
@ -238,3 +191,34 @@ func home() (string, error) {
|
||||
|
||||
return currentUser.HomeDir, nil
|
||||
}
|
||||
|
||||
// migrateOldConfig copies any existing configuration from the old location
|
||||
// to the new, XDG-compatible location
|
||||
func migrateOldConfig() {
|
||||
srcDir, _ := expandHomeDir(WtfConfigDirV1)
|
||||
destDir, _ := WtfConfigDir()
|
||||
|
||||
// If the old config directory doesn't exist, do not move
|
||||
if _, err := os.Stat(srcDir); os.IsNotExist(err) {
|
||||
return
|
||||
}
|
||||
|
||||
// If the new config directory already exists, do not move
|
||||
if _, err := os.Stat(destDir); err == nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Time to move
|
||||
err := Copy(srcDir, destDir)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// Delete the old directory if the new one exists
|
||||
if _, err := os.Stat(destDir); err == nil {
|
||||
err := os.RemoveAll(srcDir)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,17 +34,17 @@ func fcopy(src, dest string, info os.FileInfo) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer f.Close()
|
||||
defer func() { _ = f.Close() }()
|
||||
|
||||
if err = os.Chmod(f.Name(), info.Mode()); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
s, err := os.Open(src)
|
||||
s, err := os.Open(filepath.Clean(src))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer s.Close()
|
||||
defer func() { _ = f.Close() }()
|
||||
|
||||
_, err = io.Copy(f, s)
|
||||
return err
|
||||
|
109
cfg/default_color_theme.go
Normal file
109
cfg/default_color_theme.go
Normal file
@ -0,0 +1,109 @@
|
||||
package cfg
|
||||
|
||||
import (
|
||||
"github.com/olebedev/config"
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
// BorderTheme defines the default color scheme for drawing widget borders
|
||||
type BorderTheme struct {
|
||||
Focusable string
|
||||
Focused string
|
||||
Unfocusable string
|
||||
}
|
||||
|
||||
// CheckboxTheme defines the default color scheme for drawing checkable rows in widgets
|
||||
type CheckboxTheme struct {
|
||||
Checked string
|
||||
}
|
||||
|
||||
// RowTheme defines the default color scheme for row text
|
||||
type RowTheme struct {
|
||||
EvenBackground string
|
||||
EvenForeground string
|
||||
|
||||
OddBackground string
|
||||
OddForeground string
|
||||
|
||||
HighlightedBackground string
|
||||
HighlightedForeground string
|
||||
}
|
||||
|
||||
// TextTheme defines the default color scheme for text rendering
|
||||
type TextTheme struct {
|
||||
Label string
|
||||
Subheading string
|
||||
Text string
|
||||
Title string
|
||||
}
|
||||
|
||||
// WidgetTheme defines the default color scheme for the widget rect itself
|
||||
type WidgetTheme struct {
|
||||
Background string
|
||||
}
|
||||
|
||||
// ColorTheme is an alamgam of all the default color settings
|
||||
type ColorTheme struct {
|
||||
BorderTheme
|
||||
CheckboxTheme
|
||||
RowTheme
|
||||
TextTheme
|
||||
WidgetTheme
|
||||
}
|
||||
|
||||
// NewDefaultColorTheme creates and returns an instance of DefaultColorTheme
|
||||
func NewDefaultColorTheme() ColorTheme {
|
||||
defaultTheme := ColorTheme{
|
||||
BorderTheme: BorderTheme{
|
||||
Focusable: "blue",
|
||||
Focused: "orange",
|
||||
Unfocusable: "gray",
|
||||
},
|
||||
|
||||
CheckboxTheme: CheckboxTheme{
|
||||
Checked: "gray",
|
||||
},
|
||||
|
||||
RowTheme: RowTheme{
|
||||
EvenBackground: "transparent",
|
||||
EvenForeground: "white",
|
||||
|
||||
OddBackground: "transparent",
|
||||
OddForeground: "lightblue",
|
||||
|
||||
HighlightedForeground: "black",
|
||||
HighlightedBackground: "green",
|
||||
},
|
||||
|
||||
TextTheme: TextTheme{
|
||||
Label: "lightblue",
|
||||
Subheading: "red",
|
||||
Text: "white",
|
||||
Title: "green",
|
||||
},
|
||||
|
||||
WidgetTheme: WidgetTheme{
|
||||
Background: "transparent",
|
||||
},
|
||||
}
|
||||
|
||||
return defaultTheme
|
||||
}
|
||||
|
||||
// NewDefaultColorConfig creates and returns a config.Config-compatible configuration struct
|
||||
// using a DefaultColorTheme to pre-populate all the relevant values
|
||||
func NewDefaultColorConfig() (*config.Config, error) {
|
||||
colorTheme := NewDefaultColorTheme()
|
||||
|
||||
yamlBytes, err := yaml.Marshal(colorTheme)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cfg, err := config.ParseYamlBytes(yamlBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return cfg, nil
|
||||
}
|
26
cfg/default_color_theme_test.go
Normal file
26
cfg/default_color_theme_test.go
Normal file
@ -0,0 +1,26 @@
|
||||
package cfg
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func Test_NewDefaultColorTheme(t *testing.T) {
|
||||
theme := NewDefaultColorTheme()
|
||||
|
||||
assert.Equal(t, "orange", theme.BorderTheme.Focused)
|
||||
assert.Equal(t, "red", theme.TextTheme.Subheading)
|
||||
assert.Equal(t, "transparent", theme.WidgetTheme.Background)
|
||||
}
|
||||
|
||||
func Test_NewDefaultColorConfig(t *testing.T) {
|
||||
cfg, err := NewDefaultColorConfig()
|
||||
|
||||
assert.Nil(t, err)
|
||||
|
||||
assert.Equal(t, "orange", cfg.UString("bordertheme.focused"))
|
||||
assert.Equal(t, "red", cfg.UString("texttheme.subheading"))
|
||||
assert.Equal(t, "transparent", cfg.UString("widgettheme.background"))
|
||||
assert.Equal(t, "", cfg.UString("widgettheme.missing"))
|
||||
}
|
104
cfg/default_config_file.go
Normal file
104
cfg/default_config_file.go
Normal file
@ -0,0 +1,104 @@
|
||||
package cfg
|
||||
|
||||
const defaultConfigFile = `wtf:
|
||||
colors:
|
||||
border:
|
||||
focusable: darkslateblue
|
||||
focused: orange
|
||||
normal: gray
|
||||
grid:
|
||||
columns: [32, 32, 32, 32, 90]
|
||||
rows: [10, 10, 10, 4, 4, 90]
|
||||
refreshInterval: 1
|
||||
mods:
|
||||
clocks_a:
|
||||
colors:
|
||||
rows:
|
||||
even: "lightblue"
|
||||
odd: "white"
|
||||
enabled: true
|
||||
locations:
|
||||
Vancouver: "America/Vancouver"
|
||||
Toronto: "America/Toronto"
|
||||
position:
|
||||
top: 0
|
||||
left: 1
|
||||
height: 1
|
||||
width: 1
|
||||
refreshInterval: 15
|
||||
sort: "alphabetical"
|
||||
title: "Clocks A"
|
||||
type: "clocks"
|
||||
clocks_b:
|
||||
colors:
|
||||
rows:
|
||||
even: "lightblue"
|
||||
odd: "white"
|
||||
enabled: true
|
||||
locations:
|
||||
Paris: "Europe/Paris"
|
||||
Barcelona: "Europe/Madrid"
|
||||
Dubai: "Asia/Dubai"
|
||||
position:
|
||||
top: 0
|
||||
left: 2
|
||||
height: 1
|
||||
width: 1
|
||||
refreshInterval: 15
|
||||
sort: "alphabetical"
|
||||
title: "Clocks B"
|
||||
type: "clocks"
|
||||
feedreader:
|
||||
enabled: true
|
||||
feeds:
|
||||
- http://wtfutil.com/blog/index.xml
|
||||
feedLimit: 10
|
||||
position:
|
||||
top: 1
|
||||
left: 1
|
||||
width: 2
|
||||
height: 1
|
||||
refreshInterval: 14400
|
||||
ipinfo:
|
||||
colors:
|
||||
name: "lightblue"
|
||||
value: "white"
|
||||
enabled: true
|
||||
position:
|
||||
top: 2
|
||||
left: 1
|
||||
height: 1
|
||||
width: 1
|
||||
refreshInterval: 150
|
||||
power:
|
||||
enabled: true
|
||||
position:
|
||||
top: 2
|
||||
left: 2
|
||||
height: 1
|
||||
width: 1
|
||||
refreshInterval: 15
|
||||
title: "⚡️"
|
||||
textfile:
|
||||
enabled: true
|
||||
filePath: "~/.config/wtf/config.yml"
|
||||
format: true
|
||||
position:
|
||||
top: 0
|
||||
left: 0
|
||||
height: 4
|
||||
width: 1
|
||||
refreshInterval: 30
|
||||
wrapText: false
|
||||
uptime:
|
||||
args: [""]
|
||||
cmd: "uptime"
|
||||
enabled: true
|
||||
position:
|
||||
top: 3
|
||||
left: 1
|
||||
height: 1
|
||||
width: 2
|
||||
refreshInterval: 30
|
||||
type: cmdrunner
|
||||
`
|
48
cfg/error_messages.go
Normal file
48
cfg/error_messages.go
Normal file
@ -0,0 +1,48 @@
|
||||
package cfg
|
||||
|
||||
// This file contains the error messages that get written to the terminal when
|
||||
// something goes wrong with the configuration process.
|
||||
//
|
||||
// As a general rule, if one of these has to be shown the app should then die
|
||||
// via os.Exit(1)
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/logrusorgru/aurora"
|
||||
)
|
||||
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
|
||||
func displayError(err error) {
|
||||
fmt.Printf("%s %s\n\n", aurora.Red("Error:"), err.Error())
|
||||
}
|
||||
|
||||
func displayDefaultConfigCreateError(err error) {
|
||||
fmt.Printf("\n%s Could not create the default configuration file.\n", aurora.Red("ERROR"))
|
||||
fmt.Println()
|
||||
displayError(err)
|
||||
}
|
||||
|
||||
func displayDefaultConfigWriteError(err error) {
|
||||
fmt.Printf("\n%s Could not write the default configuration file.\n", aurora.Red("ERROR"))
|
||||
fmt.Println()
|
||||
displayError(err)
|
||||
}
|
||||
|
||||
func displayWtfConfigDirCreateError(err error) {
|
||||
fmt.Printf("\n%s Could not create the '%s' directory.\n", aurora.Red("ERROR"), aurora.Yellow(WtfConfigDirV2))
|
||||
fmt.Println()
|
||||
displayError(err)
|
||||
}
|
||||
|
||||
func displayWtfConfigFileLoadError(path string, err error) {
|
||||
fmt.Printf("\n%s Could not load '%s'.\n", aurora.Red("ERROR"), aurora.Yellow(path))
|
||||
fmt.Println()
|
||||
fmt.Println("This could mean one of two things:")
|
||||
fmt.Println()
|
||||
fmt.Println(" 1. That file doesn't exist.")
|
||||
fmt.Println(" 2. That file has a YAML syntax error. Try running it through http://www.yamllint.com to check for errors.")
|
||||
fmt.Println()
|
||||
displayError(err)
|
||||
}
|
28
cfg/parsers.go
Normal file
28
cfg/parsers.go
Normal file
@ -0,0 +1,28 @@
|
||||
package cfg
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/olebedev/config"
|
||||
)
|
||||
|
||||
// ParseAsMapOrList takes a configuration key and attempts to parse it first as a map
|
||||
// and then as a list. Map entries are concatenated as "key/value"
|
||||
func ParseAsMapOrList(ymlConfig *config.Config, configKey string) []string {
|
||||
result := []string{}
|
||||
|
||||
mapItems, err := ymlConfig.Map(configKey)
|
||||
if err == nil {
|
||||
for key, value := range mapItems {
|
||||
result = append(result, fmt.Sprintf("%s/%s", value, key))
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
listItems := ymlConfig.UList(configKey)
|
||||
for _, listItem := range listItems {
|
||||
result = append(result, listItem.(string))
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
50
cfg/parsers_test.go
Normal file
50
cfg/parsers_test.go
Normal file
@ -0,0 +1,50 @@
|
||||
package cfg
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/olebedev/config"
|
||||
)
|
||||
|
||||
func Test_ParseAsMapOrList(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
configKey string
|
||||
yaml string
|
||||
expectedCount int
|
||||
}{
|
||||
{
|
||||
name: "as empty set",
|
||||
configKey: "data",
|
||||
yaml: "",
|
||||
expectedCount: 0,
|
||||
},
|
||||
{
|
||||
name: "as map",
|
||||
configKey: "data",
|
||||
yaml: "data:\n a: cat\n b: dog",
|
||||
expectedCount: 2,
|
||||
},
|
||||
{
|
||||
name: "as list",
|
||||
configKey: "data",
|
||||
yaml: "data:\n - cat\n - dog\n - rat\n",
|
||||
expectedCount: 3,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
ymlConfig, err := config.ParseYaml(tt.yaml)
|
||||
if err != nil {
|
||||
t.Errorf("\nexpected: no error\n got: %v", err)
|
||||
}
|
||||
|
||||
actual := ParseAsMapOrList(ymlConfig, tt.configKey)
|
||||
|
||||
if tt.expectedCount != len(actual) {
|
||||
t.Errorf("\nexpected: %d\n got: %d", tt.expectedCount, len(actual))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
51
cfg/position_settings.go
Normal file
51
cfg/position_settings.go
Normal file
@ -0,0 +1,51 @@
|
||||
package cfg
|
||||
|
||||
import (
|
||||
"github.com/olebedev/config"
|
||||
)
|
||||
|
||||
const (
|
||||
positionPath = "position"
|
||||
)
|
||||
|
||||
// PositionSettings represents the onscreen location of a widget
|
||||
type PositionSettings struct {
|
||||
Validations *Validations
|
||||
|
||||
Height int
|
||||
Left int
|
||||
Top int
|
||||
Width int
|
||||
}
|
||||
|
||||
// NewPositionSettingsFromYAML creates and returns a new instance of cfg.Position
|
||||
func NewPositionSettingsFromYAML(moduleName string, moduleConfig *config.Config) PositionSettings {
|
||||
var currVal int
|
||||
var err error
|
||||
|
||||
validations := NewValidations()
|
||||
|
||||
// Parse the positional data from the config data
|
||||
currVal, err = moduleConfig.Int(positionPath + ".top")
|
||||
validations.append("top", newPositionValidation("top", currVal, err))
|
||||
|
||||
currVal, err = moduleConfig.Int(positionPath + ".left")
|
||||
validations.append("left", newPositionValidation("left", currVal, err))
|
||||
|
||||
currVal, err = moduleConfig.Int(positionPath + ".width")
|
||||
validations.append("width", newPositionValidation("width", currVal, err))
|
||||
|
||||
currVal, err = moduleConfig.Int(positionPath + ".height")
|
||||
validations.append("height", newPositionValidation("height", currVal, err))
|
||||
|
||||
pos := PositionSettings{
|
||||
Validations: validations,
|
||||
|
||||
Top: validations.intValueFor("top"),
|
||||
Left: validations.intValueFor("left"),
|
||||
Width: validations.intValueFor("width"),
|
||||
Height: validations.intValueFor("height"),
|
||||
}
|
||||
|
||||
return pos
|
||||
}
|
67
cfg/position_validation.go
Normal file
67
cfg/position_validation.go
Normal file
@ -0,0 +1,67 @@
|
||||
package cfg
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/logrusorgru/aurora"
|
||||
)
|
||||
|
||||
// Common examples of invalid position configuration are:
|
||||
//
|
||||
// position:
|
||||
// top: -3
|
||||
// left: 2
|
||||
// width: 0
|
||||
// height: 1
|
||||
//
|
||||
// position:
|
||||
// top: 3
|
||||
// width: 2
|
||||
// height: 1
|
||||
//
|
||||
// position:
|
||||
// top: 3
|
||||
// # left: 2
|
||||
// width: 2
|
||||
// height: 1
|
||||
//
|
||||
// position:
|
||||
// top: 3
|
||||
// left: 2
|
||||
// width: 2
|
||||
// height: 1
|
||||
//
|
||||
type positionValidation struct {
|
||||
err error
|
||||
name string
|
||||
intVal int
|
||||
}
|
||||
|
||||
func (posVal *positionValidation) Error() error {
|
||||
return posVal.err
|
||||
}
|
||||
|
||||
func (posVal *positionValidation) HasError() bool {
|
||||
return posVal.err != nil
|
||||
}
|
||||
|
||||
func (posVal *positionValidation) IntValue() int {
|
||||
return posVal.intVal
|
||||
}
|
||||
|
||||
// String returns the Stringer representation of the positionValidation
|
||||
func (posVal *positionValidation) String() string {
|
||||
return fmt.Sprintf("Invalid value for %s:\t%d", aurora.Yellow(posVal.name), posVal.intVal)
|
||||
}
|
||||
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
|
||||
func newPositionValidation(name string, intVal int, err error) *positionValidation {
|
||||
posVal := &positionValidation{
|
||||
err: err,
|
||||
name: name,
|
||||
intVal: intVal,
|
||||
}
|
||||
|
||||
return posVal
|
||||
}
|
26
cfg/position_validation_test.go
Normal file
26
cfg/position_validation_test.go
Normal file
@ -0,0 +1,26 @@
|
||||
package cfg
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
var (
|
||||
posVal = &positionValidation{
|
||||
err: errors.New("Busted"),
|
||||
name: "top",
|
||||
intVal: -3,
|
||||
}
|
||||
)
|
||||
|
||||
func Test_Attributes(t *testing.T) {
|
||||
assert.EqualError(t, posVal.Error(), "Busted")
|
||||
assert.Equal(t, true, posVal.HasError())
|
||||
assert.Equal(t, -3, posVal.IntValue())
|
||||
|
||||
assert.Contains(t, posVal.String(), "Invalid")
|
||||
assert.Contains(t, posVal.String(), "top")
|
||||
assert.Contains(t, posVal.String(), "-3")
|
||||
}
|
224
cfg/secrets.go
Normal file
224
cfg/secrets.go
Normal file
@ -0,0 +1,224 @@
|
||||
package cfg
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"runtime"
|
||||
|
||||
"github.com/docker/docker-credential-helpers/client"
|
||||
"github.com/docker/docker-credential-helpers/credentials"
|
||||
"github.com/olebedev/config"
|
||||
"github.com/wtfutil/wtf/logger"
|
||||
)
|
||||
|
||||
type SecretLoadParams struct {
|
||||
name string
|
||||
globalConfig *config.Config
|
||||
service string
|
||||
|
||||
secret *string
|
||||
}
|
||||
|
||||
// Load module secrets.
|
||||
//
|
||||
// The credential helpers impose this structure:
|
||||
//
|
||||
// SERVICE is mapped to a SECRET and USERNAME
|
||||
//
|
||||
// Only SECRET is secret, SERVICE and USERNAME are not, so this
|
||||
// API doesn't expose USERNAME.
|
||||
//
|
||||
// SERVICE was intended to be the URL of an API server, but
|
||||
// for hosted services that do not have or need a configurable
|
||||
// API server, its easier to just use the module name as the
|
||||
// SERVICE:
|
||||
//
|
||||
// cfg.ModuleSecret(name, globalConfig, &settings.apiKey).Load()
|
||||
//
|
||||
// The user will use the module name as the service, and the API key as
|
||||
// the secret, for example:
|
||||
//
|
||||
// % wtfutil save-secret circleci
|
||||
// Secret: ...
|
||||
//
|
||||
// If a module (such as pihole, jenkins, or github) might have multiple
|
||||
// instantiations each using a different API service (with its own unique
|
||||
// API key), then the module should use the API URL to lookup the secret.
|
||||
// For example, for github:
|
||||
//
|
||||
// cfg.ModuleSecret(name, globalConfig, &settings.apiKey).
|
||||
// Service(settings.baseURL).
|
||||
// Load()
|
||||
//
|
||||
// The user will use the API URL as the service, and the API key as the
|
||||
// secret, for example, with github configured as:
|
||||
//
|
||||
// -- config.yml
|
||||
// mods:
|
||||
// github:
|
||||
// baseURL: "https://github.mycompany.com/api/v3"
|
||||
// ...
|
||||
//
|
||||
// the secret must be saved as:
|
||||
//
|
||||
// % wtfutil save-secret https://github.mycompany.com/api/v3
|
||||
// Secret: ...
|
||||
//
|
||||
// If baseURL is not set in the configuration it will be the modules
|
||||
// default, and the SERVICE will default to the module name, "github",
|
||||
// and the user must save the secret as:
|
||||
//
|
||||
// % wtfutil save-secret github
|
||||
// Secret: ...
|
||||
//
|
||||
// Ideally, the individual module documentation would describe the
|
||||
// SERVICE name to use to save the secret.
|
||||
func ModuleSecret(name string, globalConfig *config.Config, secret *string) *SecretLoadParams {
|
||||
return &SecretLoadParams{
|
||||
name: name,
|
||||
globalConfig: globalConfig,
|
||||
secret: secret,
|
||||
service: name, // Default the service to the module name
|
||||
}
|
||||
}
|
||||
|
||||
func (slp *SecretLoadParams) Service(service string) *SecretLoadParams {
|
||||
if service != "" {
|
||||
slp.service = service
|
||||
}
|
||||
return slp
|
||||
}
|
||||
|
||||
func (slp *SecretLoadParams) Load() {
|
||||
configureSecret(
|
||||
slp.globalConfig,
|
||||
slp.service,
|
||||
slp.secret,
|
||||
)
|
||||
}
|
||||
|
||||
type Secret struct {
|
||||
Service string
|
||||
Secret string
|
||||
Username string
|
||||
Store string
|
||||
}
|
||||
|
||||
func configureSecret(
|
||||
globalConfig *config.Config,
|
||||
service string,
|
||||
secret *string,
|
||||
) {
|
||||
if service == "" {
|
||||
return
|
||||
}
|
||||
|
||||
if secret == nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Don't overwrite the secret if it was configured with yaml
|
||||
if *secret != "" {
|
||||
return
|
||||
}
|
||||
|
||||
cred, err := FetchSecret(globalConfig, service)
|
||||
|
||||
if err != nil {
|
||||
logger.Log(fmt.Sprintf("Loading secret failed: %s", err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
if cred == nil {
|
||||
// No secret store configued.
|
||||
return
|
||||
}
|
||||
|
||||
if secret != nil && *secret == "" {
|
||||
*secret = cred.Secret
|
||||
}
|
||||
}
|
||||
|
||||
// Fetch secret for `service`. Service is customarily a URL, but can be any
|
||||
// identifier uniquely used by wtf to identify the service, such as the name
|
||||
// of the module. nil is returned if the secretStore global property is not
|
||||
// present or the secret is not found in that store.
|
||||
func FetchSecret(globalConfig *config.Config, service string) (*Secret, error) {
|
||||
prog := newProgram(globalConfig)
|
||||
|
||||
if prog == nil {
|
||||
// No secret store configured.
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
cred, err := client.Get(prog.runner, service)
|
||||
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("get %v from %v: %w", service, prog.store, err)
|
||||
}
|
||||
|
||||
return &Secret{
|
||||
Service: cred.ServerURL,
|
||||
Secret: cred.Secret,
|
||||
Username: cred.Username,
|
||||
Store: prog.store,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func StoreSecret(globalConfig *config.Config, secret *Secret) error {
|
||||
prog := newProgram(globalConfig)
|
||||
|
||||
if prog == nil {
|
||||
return errors.New("cannot store secrets: wtf.secretStore is not configured")
|
||||
}
|
||||
|
||||
cred := &credentials.Credentials{
|
||||
ServerURL: secret.Service,
|
||||
Username: secret.Username,
|
||||
Secret: secret.Secret,
|
||||
}
|
||||
|
||||
// docker-credential requires a username, but it isn't necessary for
|
||||
// all services. Use a default if a username was not set.
|
||||
if cred.Username == "" {
|
||||
cred.Username = "default"
|
||||
}
|
||||
|
||||
err := client.Store(prog.runner, cred)
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("store %v: %w", prog.store, err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type program struct {
|
||||
store string
|
||||
runner client.ProgramFunc
|
||||
}
|
||||
|
||||
func newProgram(globalConfig *config.Config) *program {
|
||||
secretStore := globalConfig.UString("wtf.secretStore", "(none)")
|
||||
|
||||
if secretStore == "(none)" {
|
||||
return nil
|
||||
}
|
||||
|
||||
if secretStore == "" {
|
||||
switch runtime.GOOS {
|
||||
case "windows":
|
||||
secretStore = "winrt"
|
||||
case "darwin":
|
||||
secretStore = "osxkeychain"
|
||||
default:
|
||||
secretStore = "secretservice"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return &program{
|
||||
secretStore,
|
||||
client.NewShellProgramFunc("docker-credential-" + secretStore),
|
||||
}
|
||||
}
|
9
cfg/validatable.go
Normal file
9
cfg/validatable.go
Normal file
@ -0,0 +1,9 @@
|
||||
package cfg
|
||||
|
||||
// Validatable is implemented by any value that validates a configuration setting
|
||||
type Validatable interface {
|
||||
Error() error
|
||||
HasError() bool
|
||||
String() string
|
||||
IntValue() int
|
||||
}
|
28
cfg/validations.go
Normal file
28
cfg/validations.go
Normal file
@ -0,0 +1,28 @@
|
||||
package cfg
|
||||
|
||||
// Validations represent a collection of config setting validations
|
||||
type Validations struct {
|
||||
validations map[string]Validatable
|
||||
}
|
||||
|
||||
// NewValidations creates and returns an instance of Validations
|
||||
func NewValidations() *Validations {
|
||||
vals := &Validations{
|
||||
validations: make(map[string]Validatable),
|
||||
}
|
||||
|
||||
return vals
|
||||
}
|
||||
|
||||
func (vals *Validations) append(key string, posVal Validatable) {
|
||||
vals.validations[key] = posVal
|
||||
}
|
||||
|
||||
func (vals *Validations) intValueFor(key string) int {
|
||||
val := vals.validations[key]
|
||||
if val != nil {
|
||||
return val.IntValue()
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
38
cfg/validations_test.go
Normal file
38
cfg/validations_test.go
Normal file
@ -0,0 +1,38 @@
|
||||
package cfg
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
var (
|
||||
vals = NewValidations()
|
||||
)
|
||||
|
||||
func Test_intValueFor(t *testing.T) {
|
||||
vals.append("left", newPositionValidation("left", 3, nil))
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
key string
|
||||
expected int
|
||||
}{
|
||||
{
|
||||
name: "with valid key",
|
||||
key: "left",
|
||||
expected: 3,
|
||||
},
|
||||
{
|
||||
name: "with invalid key",
|
||||
key: "cat",
|
||||
expected: 0,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
assert.Equal(t, tt.expected, vals.intValueFor(tt.key))
|
||||
})
|
||||
}
|
||||
}
|
@ -22,7 +22,8 @@ func NewChecklist(checkedIcon, uncheckedIcon string) Checklist {
|
||||
|
||||
/* -------------------- Exported Functions -------------------- */
|
||||
|
||||
// Add creates a new item in the checklist
|
||||
// Add creates a new checklist item and prepends it onto the existing
|
||||
// list of items. The new one is at the start of the list
|
||||
func (list *Checklist) Add(checked bool, text string) {
|
||||
item := NewChecklistItem(
|
||||
checked,
|
||||
@ -48,9 +49,10 @@ func (list *Checklist) CheckedItems() []*ChecklistItem {
|
||||
}
|
||||
|
||||
// Delete removes the selected item from the checklist
|
||||
func (list *Checklist) Delete() {
|
||||
list.Items = append(list.Items[:list.selected], list.Items[list.selected+1:]...)
|
||||
list.Prev()
|
||||
func (list *Checklist) Delete(selectedIndex int) {
|
||||
if selectedIndex >= 0 && selectedIndex < len(list.Items) {
|
||||
list.Items = append(list.Items[:selectedIndex], list.Items[selectedIndex+1:]...)
|
||||
}
|
||||
}
|
||||
|
||||
// IsSelectable returns true if the checklist has selectable items, false if it does not
|
||||
@ -76,35 +78,14 @@ func (list *Checklist) LongestLine() int {
|
||||
return maxLen
|
||||
}
|
||||
|
||||
func (list *Checklist) Selected() int {
|
||||
return list.selected
|
||||
}
|
||||
|
||||
// SelectedItem returns the currently-selected checklist item or nil if no item is selected
|
||||
func (list *Checklist) SelectedItem() *ChecklistItem {
|
||||
if list.IsUnselectable() {
|
||||
return nil
|
||||
}
|
||||
|
||||
return list.Items[list.selected]
|
||||
}
|
||||
|
||||
func (list *Checklist) SetSelectedByItem(selectableItem *ChecklistItem) {
|
||||
// IndexByItem returns the index of a giving item if found, otherwise returns 0 with ok set to false
|
||||
func (list *Checklist) IndexByItem(selectableItem *ChecklistItem) (index int, ok bool) {
|
||||
for idx, item := range list.Items {
|
||||
if item == selectableItem {
|
||||
list.selected = idx
|
||||
break
|
||||
return idx, true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Toggle switches the checked state of the currently-selected item
|
||||
func (list *Checklist) Toggle() {
|
||||
if list.IsUnselectable() {
|
||||
return
|
||||
}
|
||||
|
||||
list.SelectedItem().Toggle()
|
||||
return 0, false
|
||||
}
|
||||
|
||||
// UncheckedItems returns a slice of all the unchecked items
|
||||
@ -125,65 +106,6 @@ func (list *Checklist) Unselect() {
|
||||
list.selected = -1
|
||||
}
|
||||
|
||||
// Update sets the text of the currently-selected item to the provided text
|
||||
func (list *Checklist) Update(text string) {
|
||||
item := list.SelectedItem()
|
||||
|
||||
if item == nil {
|
||||
return
|
||||
}
|
||||
|
||||
item.Text = text
|
||||
}
|
||||
|
||||
/* -------------------- Item Movement -------------------- */
|
||||
|
||||
// Prev selects the previous item UP in the checklist
|
||||
func (list *Checklist) Prev() {
|
||||
list.selected--
|
||||
if list.selected < 0 {
|
||||
list.selected = len(list.Items) - 1
|
||||
}
|
||||
}
|
||||
|
||||
// Next selects the next item DOWN in the checklist
|
||||
func (list *Checklist) Next() {
|
||||
list.selected++
|
||||
if list.selected >= len(list.Items) {
|
||||
list.selected = 0
|
||||
}
|
||||
}
|
||||
|
||||
// Promote moves the selected item UP in the checklist
|
||||
func (list *Checklist) Promote() {
|
||||
if list.IsUnselectable() {
|
||||
return
|
||||
}
|
||||
|
||||
k := list.selected - 1
|
||||
if k < 0 {
|
||||
k = len(list.Items) - 1
|
||||
}
|
||||
|
||||
list.Swap(list.selected, k)
|
||||
list.selected = k
|
||||
}
|
||||
|
||||
// Demote moves the selected item DOWN in the checklist
|
||||
func (list *Checklist) Demote() {
|
||||
if list.IsUnselectable() {
|
||||
return
|
||||
}
|
||||
|
||||
j := list.selected + 1
|
||||
if j >= len(list.Items) {
|
||||
j = 0
|
||||
}
|
||||
|
||||
list.Swap(list.selected, j)
|
||||
list.selected = j
|
||||
}
|
||||
|
||||
/* -------------------- Sort Interface -------------------- */
|
||||
|
||||
func (list *Checklist) Len() int {
|
||||
|
@ -1,7 +1,5 @@
|
||||
package checklist
|
||||
|
||||
import ()
|
||||
|
||||
// ChecklistItem is a module for creating generic checklist implementations
|
||||
// See 'Todo' for an implementation example
|
||||
type ChecklistItem struct {
|
||||
|
36
checklist/checklist_item_test.go
Normal file
36
checklist/checklist_item_test.go
Normal file
@ -0,0 +1,36 @@
|
||||
package checklist
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
. "github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func testChecklistItem() *ChecklistItem {
|
||||
item := NewChecklistItem(
|
||||
false,
|
||||
"test",
|
||||
"",
|
||||
"",
|
||||
)
|
||||
return item
|
||||
}
|
||||
|
||||
func Test_CheckMark(t *testing.T) {
|
||||
item := testChecklistItem()
|
||||
Equal(t, " ", item.CheckMark())
|
||||
|
||||
item.Toggle()
|
||||
Equal(t, "x", item.CheckMark())
|
||||
}
|
||||
|
||||
func Test_Toggle(t *testing.T) {
|
||||
item := testChecklistItem()
|
||||
Equal(t, false, item.Checked)
|
||||
|
||||
item.Toggle()
|
||||
Equal(t, true, item.Checked)
|
||||
|
||||
item.Toggle()
|
||||
Equal(t, false, item.Checked)
|
||||
}
|
436
checklist/checklist_test.go
Normal file
436
checklist/checklist_test.go
Normal file
@ -0,0 +1,436 @@
|
||||
package checklist
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func Test_NewCheckist(t *testing.T) {
|
||||
cl := NewChecklist("o", "-")
|
||||
|
||||
assert.IsType(t, Checklist{}, cl)
|
||||
assert.Equal(t, "o", cl.checkedIcon)
|
||||
assert.Equal(t, -1, cl.selected)
|
||||
assert.Equal(t, "-", cl.uncheckedIcon)
|
||||
assert.Equal(t, 0, len(cl.Items))
|
||||
}
|
||||
|
||||
func Test_Add(t *testing.T) {
|
||||
cl := NewChecklist("o", "-")
|
||||
cl.Add(true, "test item")
|
||||
|
||||
assert.Equal(t, 1, len(cl.Items))
|
||||
}
|
||||
|
||||
func Test_CheckedItems(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
expectedLen int
|
||||
checkedLen int
|
||||
before func(cl *Checklist)
|
||||
}{
|
||||
{
|
||||
name: "with no items",
|
||||
expectedLen: 0,
|
||||
checkedLen: 0,
|
||||
before: func(cl *Checklist) {},
|
||||
},
|
||||
{
|
||||
name: "with no checked items",
|
||||
expectedLen: 1,
|
||||
checkedLen: 0,
|
||||
before: func(cl *Checklist) {
|
||||
cl.Add(false, "unchecked item")
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "with one checked item",
|
||||
expectedLen: 2,
|
||||
checkedLen: 1,
|
||||
before: func(cl *Checklist) {
|
||||
cl.Add(false, "unchecked item")
|
||||
cl.Add(true, "checked item")
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "with multiple checked items",
|
||||
expectedLen: 3,
|
||||
checkedLen: 2,
|
||||
before: func(cl *Checklist) {
|
||||
cl.Add(false, "unchecked item")
|
||||
cl.Add(true, "checked item 11")
|
||||
cl.Add(true, "checked item 2")
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
cl := NewChecklist("o", "-")
|
||||
tt.before(&cl)
|
||||
|
||||
assert.Equal(t, tt.expectedLen, len(cl.Items))
|
||||
assert.Equal(t, tt.checkedLen, len(cl.CheckedItems()))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func Test_Delete(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
idx int
|
||||
expectedLen int
|
||||
}{
|
||||
{
|
||||
name: "with valid index",
|
||||
idx: 0,
|
||||
expectedLen: 0,
|
||||
},
|
||||
{
|
||||
name: "with invalid index",
|
||||
idx: 2,
|
||||
expectedLen: 1,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
cl := NewChecklist("o", "-")
|
||||
|
||||
cl.Add(true, "test item")
|
||||
cl.Delete(tt.idx)
|
||||
|
||||
assert.Equal(t, tt.expectedLen, len(cl.Items))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func Test_IsSelectable(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
selected int
|
||||
expected bool
|
||||
}{
|
||||
{
|
||||
name: "nothing selected",
|
||||
selected: -1,
|
||||
expected: false,
|
||||
},
|
||||
{
|
||||
name: "valid selection",
|
||||
selected: 1,
|
||||
expected: true,
|
||||
},
|
||||
{
|
||||
name: "invalid selection",
|
||||
selected: 3,
|
||||
expected: false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
cl := NewChecklist("o", "-")
|
||||
cl.Add(true, "test item 1")
|
||||
cl.Add(false, "test item 2")
|
||||
|
||||
cl.selected = tt.selected
|
||||
|
||||
assert.Equal(t, tt.expected, cl.IsSelectable())
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func Test_IsUnselectable(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
selected int
|
||||
expected bool
|
||||
}{
|
||||
{
|
||||
name: "nothing selected",
|
||||
selected: -1,
|
||||
expected: true,
|
||||
},
|
||||
{
|
||||
name: "valid selection",
|
||||
selected: 1,
|
||||
expected: false,
|
||||
},
|
||||
{
|
||||
name: "invalid selection",
|
||||
selected: 3,
|
||||
expected: true,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
cl := NewChecklist("o", "-")
|
||||
cl.Add(true, "test item 1")
|
||||
cl.Add(false, "test item 2")
|
||||
|
||||
cl.selected = tt.selected
|
||||
|
||||
assert.Equal(t, tt.expected, cl.IsUnselectable())
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func Test_LongestLine(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
expectedLen int
|
||||
before func(cl *Checklist)
|
||||
}{
|
||||
{
|
||||
name: "with no items",
|
||||
expectedLen: 0,
|
||||
before: func(cl *Checklist) {},
|
||||
},
|
||||
{
|
||||
name: "with different-length items",
|
||||
expectedLen: 12,
|
||||
before: func(cl *Checklist) {
|
||||
cl.Add(true, "test item 1")
|
||||
cl.Add(false, "test item 22")
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "with same-length items",
|
||||
expectedLen: 11,
|
||||
before: func(cl *Checklist) {
|
||||
cl.Add(true, "test item 1")
|
||||
cl.Add(false, "test item 2")
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
cl := NewChecklist("o", "-")
|
||||
tt.before(&cl)
|
||||
|
||||
assert.Equal(t, tt.expectedLen, cl.LongestLine())
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func Test_IndexByItem(t *testing.T) {
|
||||
cl := NewChecklist("o", "-")
|
||||
cl.Add(false, "unchecked item")
|
||||
cl.Add(true, "checked item")
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
item *ChecklistItem
|
||||
expectedIdx int
|
||||
expectedOk bool
|
||||
}{
|
||||
{
|
||||
name: "with nil",
|
||||
item: nil,
|
||||
expectedIdx: 0,
|
||||
expectedOk: false,
|
||||
},
|
||||
{
|
||||
name: "with valid item",
|
||||
item: cl.Items[1],
|
||||
expectedIdx: 1,
|
||||
expectedOk: true,
|
||||
},
|
||||
{
|
||||
name: "with valid item",
|
||||
item: NewChecklistItem(false, "invalid", "x", " "),
|
||||
expectedIdx: 0,
|
||||
expectedOk: false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
|
||||
idx, ok := cl.IndexByItem(tt.item)
|
||||
|
||||
assert.Equal(t, tt.expectedIdx, idx)
|
||||
assert.Equal(t, tt.expectedOk, ok)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func Test_UncheckedItems(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
expectedLen int
|
||||
checkedLen int
|
||||
before func(cl *Checklist)
|
||||
}{
|
||||
{
|
||||
name: "with no items",
|
||||
expectedLen: 0,
|
||||
checkedLen: 0,
|
||||
before: func(cl *Checklist) {},
|
||||
},
|
||||
{
|
||||
name: "with no unchecked items",
|
||||
expectedLen: 1,
|
||||
checkedLen: 0,
|
||||
before: func(cl *Checklist) {
|
||||
cl.Add(true, "unchecked item")
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "with one unchecked item",
|
||||
expectedLen: 2,
|
||||
checkedLen: 1,
|
||||
before: func(cl *Checklist) {
|
||||
cl.Add(false, "unchecked item")
|
||||
cl.Add(true, "checked item")
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "with multiple unchecked items",
|
||||
expectedLen: 3,
|
||||
checkedLen: 2,
|
||||
before: func(cl *Checklist) {
|
||||
cl.Add(false, "unchecked item")
|
||||
cl.Add(true, "checked item 11")
|
||||
cl.Add(false, "checked item 2")
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
cl := NewChecklist("o", "-")
|
||||
tt.before(&cl)
|
||||
|
||||
assert.Equal(t, tt.expectedLen, len(cl.Items))
|
||||
assert.Equal(t, tt.checkedLen, len(cl.UncheckedItems()))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func Test_Unselect(t *testing.T) {
|
||||
cl := NewChecklist("o", "-")
|
||||
cl.Add(false, "unchecked item")
|
||||
|
||||
cl.selected = 0
|
||||
assert.Equal(t, 0, cl.selected)
|
||||
|
||||
cl.Unselect()
|
||||
assert.Equal(t, -1, cl.selected)
|
||||
}
|
||||
|
||||
/* -------------------- Sort Interface -------------------- */
|
||||
|
||||
func Test_Len(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
expectedLen int
|
||||
before func(cl *Checklist)
|
||||
}{
|
||||
{
|
||||
name: "with no items",
|
||||
expectedLen: 0,
|
||||
before: func(cl *Checklist) {},
|
||||
},
|
||||
{
|
||||
name: "with one item",
|
||||
expectedLen: 1,
|
||||
before: func(cl *Checklist) {
|
||||
cl.Add(false, "unchecked item")
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "with multiple items",
|
||||
expectedLen: 3,
|
||||
before: func(cl *Checklist) {
|
||||
cl.Add(false, "unchecked item")
|
||||
cl.Add(true, "checked item 1")
|
||||
cl.Add(false, "checked item 2")
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
cl := NewChecklist("o", "-")
|
||||
tt.before(&cl)
|
||||
|
||||
assert.Equal(t, tt.expectedLen, cl.Len())
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func Test_Less(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
first string
|
||||
second string
|
||||
expected bool
|
||||
}{
|
||||
{
|
||||
name: "same",
|
||||
first: "",
|
||||
second: "",
|
||||
expected: false,
|
||||
},
|
||||
{
|
||||
name: "last less",
|
||||
first: "beta",
|
||||
second: "alpha",
|
||||
expected: true,
|
||||
},
|
||||
{
|
||||
name: "first less",
|
||||
first: "alpha",
|
||||
second: "beta",
|
||||
expected: false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
cl := NewChecklist("o", "-")
|
||||
cl.Add(false, tt.first)
|
||||
cl.Add(false, tt.second)
|
||||
|
||||
assert.Equal(t, tt.expected, cl.Less(0, 1))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func Test_Swap(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
first string
|
||||
second string
|
||||
expected bool
|
||||
}{
|
||||
{
|
||||
name: "same",
|
||||
first: "",
|
||||
second: "",
|
||||
},
|
||||
{
|
||||
name: "last less",
|
||||
first: "alpha",
|
||||
second: "beta",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
cl := NewChecklist("o", "-")
|
||||
cl.Add(false, tt.first)
|
||||
cl.Add(false, tt.second)
|
||||
|
||||
cl.Swap(0, 1)
|
||||
|
||||
assert.Equal(t, tt.expected, cl.Items[0].Text == "beta")
|
||||
assert.Equal(t, tt.expected, cl.Items[1].Text == "alpha")
|
||||
})
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
package wtftests
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
. "github.com/stretchr/testify/assert"
|
||||
. "github.com/wtfutil/wtf/checklist"
|
||||
)
|
||||
|
||||
/* -------------------- CheckMark -------------------- */
|
||||
|
||||
func TestCheckMark(t *testing.T) {
|
||||
item := ChecklistItem{}
|
||||
Equal(t, " ", item.CheckMark())
|
||||
|
||||
item = ChecklistItem{Checked: true}
|
||||
Equal(t, "x", item.CheckMark())
|
||||
}
|
||||
|
||||
/* -------------------- Toggle -------------------- */
|
||||
|
||||
func TestToggle(t *testing.T) {
|
||||
item := ChecklistItem{}
|
||||
Equal(t, false, item.Checked)
|
||||
|
||||
item.Toggle()
|
||||
Equal(t, true, item.Checked)
|
||||
|
||||
item.Toggle()
|
||||
Equal(t, false, item.Checked)
|
||||
}
|
119
flags/flags.go
119
flags/flags.go
@ -4,20 +4,42 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/chzyer/readline"
|
||||
goFlags "github.com/jessevdk/go-flags"
|
||||
"github.com/olebedev/config"
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
"github.com/wtfutil/wtf/help"
|
||||
"github.com/wtfutil/wtf/utils"
|
||||
)
|
||||
|
||||
// Flags is the container for command line flag data
|
||||
type Flags struct {
|
||||
Config string `short:"c" long:"config" optional:"yes" description:"Path to config file"`
|
||||
Module string `short:"m" long:"module" optional:"yes" description:"Display info about a specific module, i.e.: 'wtf -m=todo'"`
|
||||
Module string `short:"m" long:"module" optional:"yes" description:"Display info about a specific module, i.e.: 'wtfutil -m=todo'"`
|
||||
Profile bool `short:"p" long:"profile" optional:"yes" description:"Profile application memory usage"`
|
||||
Version bool `short:"v" long:"version" description:"Show version info"`
|
||||
// Work-around go-flags misfeatures. If any sub-command is defined
|
||||
// then `wtf` (no sub-commands, the common usage), is warned about.
|
||||
Opt struct {
|
||||
Cmd string `positional-arg-name:"command"`
|
||||
Args []string `positional-arg-name:"args"`
|
||||
} `positional-args:"yes"`
|
||||
|
||||
hasCustom bool
|
||||
}
|
||||
|
||||
var EXTRA = `
|
||||
Commands:
|
||||
save-secret <service>
|
||||
service Service URL or module name of secret.
|
||||
Save a secret into the secret store. The secret will be prompted for.
|
||||
Requires wtf.secretStore to be configured. See individual modules for
|
||||
information on what service and secret means for their configuration,
|
||||
not all modules use secrets.
|
||||
`
|
||||
|
||||
// NewFlags creates an instance of Flags
|
||||
func NewFlags() *Flags {
|
||||
flags := Flags{}
|
||||
return &flags
|
||||
@ -25,51 +47,114 @@ func NewFlags() *Flags {
|
||||
|
||||
/* -------------------- Exported Functions -------------------- */
|
||||
|
||||
// ConfigFilePath returns the path to the currently-loaded config file
|
||||
func (flags *Flags) ConfigFilePath() string {
|
||||
return flags.Config
|
||||
}
|
||||
|
||||
func (flags *Flags) Display(version string, config *config.Config) {
|
||||
// RenderIf displays special-case information based on the flags passed
|
||||
// in, if any flags were passed in
|
||||
func (flags *Flags) RenderIf(version, date string, config *config.Config) {
|
||||
if flags.HasModule() {
|
||||
help.Display(flags.Module, config)
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
if flags.HasVersion() {
|
||||
fmt.Println(version)
|
||||
fmt.Printf("%s (%s)\n", version, date)
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
if flags.Opt.Cmd == "" {
|
||||
return
|
||||
}
|
||||
|
||||
switch cmd := flags.Opt.Cmd; cmd {
|
||||
case "save-secret":
|
||||
var service, secret string
|
||||
args := flags.Opt.Args
|
||||
|
||||
if len(args) < 1 || args[0] == "" {
|
||||
fmt.Fprintf(os.Stderr, "save-secret: service required, see `%s --help`\n", os.Args[0])
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
service = args[0]
|
||||
|
||||
if len(args) > 1 {
|
||||
fmt.Fprintf(os.Stderr, "save-secret: too many arguments, see `%s --help`\n", os.Args[0])
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
b, err := readline.Password("Secret: ")
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
secret = string(b)
|
||||
secret = strings.TrimSpace(secret)
|
||||
|
||||
if secret == "" {
|
||||
fmt.Fprintf(os.Stderr, "save-secret: secret required, see `%s --help`\n", os.Args[0])
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
err = cfg.StoreSecret(config, &cfg.Secret{
|
||||
Service: service,
|
||||
Secret: secret,
|
||||
Username: "default",
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Saving secret for service %q: %s\n", service, err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
fmt.Printf("Saved secret for service %q\n", service)
|
||||
os.Exit(0)
|
||||
default:
|
||||
fmt.Fprintf(os.Stderr, "Command `%s` is not supported, try `%s --help`\n", cmd, os.Args[0])
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
func (flags *Flags) HasConfig() bool {
|
||||
return len(flags.Config) > 0
|
||||
// HasCustomConfig returns TRUE if a config path was passed in, FALSE if one was not
|
||||
func (flags *Flags) HasCustomConfig() bool {
|
||||
return flags.hasCustom
|
||||
}
|
||||
|
||||
// HasModule returns TRUE if a module name was passed in, FALSE if one was not
|
||||
func (flags *Flags) HasModule() bool {
|
||||
return len(flags.Module) > 0
|
||||
}
|
||||
|
||||
// HasVersion returns TRUE if the version flag was passed in, FALSE if it was not
|
||||
func (flags *Flags) HasVersion() bool {
|
||||
return flags.Version == true
|
||||
return flags.Version
|
||||
}
|
||||
|
||||
// Parse parses the incoming flags
|
||||
func (flags *Flags) Parse() {
|
||||
parser := goFlags.NewParser(flags, goFlags.Default)
|
||||
if _, err := parser.Parse(); err != nil {
|
||||
if flagsErr, ok := err.(*goFlags.Error); ok && flagsErr.Type == goFlags.ErrHelp {
|
||||
fmt.Println(EXTRA)
|
||||
os.Exit(0)
|
||||
}
|
||||
}
|
||||
|
||||
// If no config file is explicitly passed in as a param,
|
||||
// set the flag to the default config file
|
||||
if !flags.HasConfig() {
|
||||
homeDir, err := utils.Home()
|
||||
if err != nil {
|
||||
fmt.Printf("Error: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
flags.Config = filepath.Join(homeDir, ".config", "wtf", "config.yml")
|
||||
// If we have a custom config, then we're done parsing parameters, we don't need to
|
||||
// generate the default value
|
||||
flags.hasCustom = (len(flags.Config) > 0)
|
||||
if flags.hasCustom {
|
||||
return
|
||||
}
|
||||
|
||||
// If no config file is explicitly passed in as a param then set the flag to the default config file
|
||||
configDir, err := cfg.WtfConfigDir()
|
||||
if err != nil {
|
||||
fmt.Printf("Error: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
flags.Config = filepath.Join(configDir, "config.yml")
|
||||
}
|
||||
|
29
generator/settings.tpl
Normal file
29
generator/settings.tpl
Normal file
@ -0,0 +1,29 @@
|
||||
package {{(Lower .Name)}}
|
||||
|
||||
import (
|
||||
"github.com/olebedev/config"
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const (
|
||||
defaultFocusable = false
|
||||
defaultTitle = "{{(.Name)}}"
|
||||
)
|
||||
|
||||
// Settings defines the configuration properties for this module
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
|
||||
// Define your settings attributes here
|
||||
}
|
||||
|
||||
// NewSettingsFromYAML creates a new settings instance from a YAML config block
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||
|
||||
// Configure your settings attributes here. See http://github.com/olebedev/config for type details
|
||||
}
|
||||
|
||||
return &settings
|
||||
}
|
@ -36,17 +36,41 @@ func main() {
|
||||
widgetName,
|
||||
}
|
||||
|
||||
tpl, _ := template.New("textwidget.tpl").Funcs(template.FuncMap{
|
||||
"Lower": strings.ToLower,
|
||||
"Title": strings.Title,
|
||||
}).ParseFiles("generator/textwidget.tpl")
|
||||
createModuleDirectory(data)
|
||||
|
||||
err := os.Mkdir(strings.ToLower(widgetName), os.ModePerm)
|
||||
generateWidgetFile(data)
|
||||
generateSettingsFile(data)
|
||||
}
|
||||
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
|
||||
func createModuleDirectory(data struct{ Name string }) {
|
||||
err := os.MkdirAll(strings.ToLower(fmt.Sprintf("modules/%s", data.Name)), os.ModePerm)
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
out, err := os.Create(fmt.Sprintf("%s/widget.go", strings.ToLower(widgetName)))
|
||||
func generateWidgetFile(data struct{ Name string }) {
|
||||
tpl, _ := template.New("textwidget.tpl").Funcs(template.FuncMap{
|
||||
"Lower": strings.ToLower,
|
||||
}).ParseFiles("generator/textwidget.tpl")
|
||||
|
||||
out, err := os.Create(fmt.Sprintf("modules/%s/widget.go", strings.ToLower(data.Name)))
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
defer out.Close()
|
||||
|
||||
tpl.Execute(out, data)
|
||||
}
|
||||
|
||||
func generateSettingsFile(data struct{ Name string }) {
|
||||
tpl, _ := template.New("settings.tpl").Funcs(template.FuncMap{
|
||||
"Lower": strings.ToLower,
|
||||
}).ParseFiles("generator/settings.tpl")
|
||||
|
||||
out, err := os.Create(fmt.Sprintf("modules/%s/settings.go", strings.ToLower(data.Name)))
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
|
@ -1,56 +1,45 @@
|
||||
// Package {{(Lower .Name)}}
|
||||
package {{(Lower .Name)}}
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/gdamore/tcell"
|
||||
"github.com/rivo/tview"
|
||||
"github.com/wtfutil/wtf/wtf"
|
||||
"github.com/wtfutil/wtf/view"
|
||||
)
|
||||
|
||||
const HelpText = `
|
||||
Keyboard commands for {{(Title .Name)}}:
|
||||
`
|
||||
|
||||
// Widget is the container for your module's data
|
||||
type Widget struct {
|
||||
wtf.HelpfulWidget
|
||||
wtf.KeyboardWidget
|
||||
wtf.TextWidget
|
||||
view.TextWidget
|
||||
|
||||
settings *Settings
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
// NewWidget creates and returns an instance of Widget
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
HelpfulWidget: wtf.NewHelpfulWidget(app, pages, HelpText),
|
||||
KeyboardWidget: wtf.NewKeyboardWidget(),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common, false),
|
||||
TextWidget: view.NewTextWidget(tviewApp, settings.common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
||||
widget.initializeKeyboardControls()
|
||||
widget.View.SetInputCapture(widget.InputCapture)
|
||||
|
||||
widget.View.SetScrollable(true)
|
||||
widget.View.SetRegions(true)
|
||||
|
||||
widget.HelpfulWidget.SetView(widget.View)
|
||||
|
||||
return &widget
|
||||
}
|
||||
|
||||
/* -------------------- Exported Functions -------------------- */
|
||||
|
||||
// Refresh updates the onscreen contents of the widget
|
||||
func (widget *Widget) Refresh() {
|
||||
|
||||
// The last call should always be to the display function
|
||||
widget.display()
|
||||
// The last call should always be to the display function
|
||||
widget.display()
|
||||
}
|
||||
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
|
||||
func (widget *Widget) display() {
|
||||
widget.Redraw(widget.CommonSettings.Title, "Some text", false)
|
||||
func (widget *Widget) content() string {
|
||||
return "This is my widget"
|
||||
}
|
||||
|
||||
func (widget *Widget) display() {
|
||||
widget.Redraw(func() (string, string, bool) {
|
||||
return widget.CommonSettings().Title, widget.content(), false
|
||||
})
|
||||
}
|
166
go.mod
166
go.mod
@ -1,96 +1,86 @@
|
||||
module github.com/wtfutil/wtf
|
||||
|
||||
go 1.12
|
||||
go 1.16
|
||||
|
||||
require (
|
||||
cloud.google.com/go v0.39.0
|
||||
code.cloudfoundry.org/bytefmt v0.0.0-20180906201452-2aa6f33b730c
|
||||
git.apache.org/thrift.git v0.12.0 // indirect
|
||||
github.com/BurntSushi/xgb v0.0.0-20160522221800-27f122750802 // indirect
|
||||
github.com/DataDog/zstd v1.4.0 // indirect
|
||||
github.com/PagerDuty/go-pagerduty v0.0.0-20181104233218-fe8f9c4593d0
|
||||
github.com/Shopify/sarama v1.22.1 // indirect
|
||||
github.com/StackExchange/wmi v0.0.0-20181212234831-e0a55b97c705
|
||||
github.com/adlio/trello v1.0.0
|
||||
github.com/alecthomas/chroma v0.6.3
|
||||
github.com/alecthomas/repr v0.0.0-20181024024818-d37bc2a10ba1 // indirect
|
||||
github.com/andygrunwald/go-gerrit v0.0.0-20190120104749-174420ebee6c
|
||||
github.com/beorn7/perks v1.0.0 // indirect
|
||||
bitbucket.org/mikehouston/asana-go v0.0.0-20201102222432-715318d0343a
|
||||
code.cloudfoundry.org/bytefmt v0.0.0-20190819182555-854d396b647c
|
||||
github.com/Azure/go-autorest v11.1.2+incompatible // indirect
|
||||
github.com/Microsoft/go-winio v0.4.14 // indirect
|
||||
github.com/PagerDuty/go-pagerduty v0.0.0-20191002190746-f60f4fc45222
|
||||
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect
|
||||
github.com/VictorAvelar/devto-api-go v1.0.0
|
||||
github.com/adlio/trello v1.8.0
|
||||
github.com/alecthomas/chroma v0.8.1
|
||||
github.com/andygrunwald/go-gerrit v0.0.0-20190825170856-5959a9bf9ff8
|
||||
github.com/briandowns/openweathermap v0.0.0-20180804155945-5f41b7c9d92d
|
||||
github.com/cenkalti/backoff v2.2.0+incompatible
|
||||
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964
|
||||
github.com/darkSasori/todoist v0.0.0-20180703032645-ec6b38b374ab
|
||||
github.com/davecgh/go-spew v1.1.1
|
||||
github.com/dlclark/regexp2 v1.1.6
|
||||
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
|
||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e
|
||||
github.com/creack/pty v1.1.11
|
||||
github.com/digitalocean/godo v1.52.0
|
||||
github.com/docker/distribution v2.7.1+incompatible // indirect
|
||||
github.com/docker/docker v1.13.1
|
||||
github.com/docker/docker-credential-helpers v0.6.3
|
||||
github.com/docker/go-connections v0.4.0 // indirect
|
||||
github.com/docker/go-units v0.4.0 // indirect
|
||||
github.com/dustin/go-humanize v1.0.0
|
||||
github.com/gdamore/encoding v1.0.0
|
||||
github.com/gdamore/tcell v1.1.2
|
||||
github.com/go-logfmt/logfmt v0.4.0 // indirect
|
||||
github.com/go-ole/go-ole v1.2.4
|
||||
github.com/go-test/deep v1.0.1 // indirect
|
||||
github.com/godbus/dbus v5.0.1+incompatible
|
||||
github.com/gogo/protobuf v1.2.1 // indirect
|
||||
github.com/golang/mock v1.3.1 // indirect
|
||||
github.com/golang/protobuf v1.3.1
|
||||
github.com/google/btree v1.0.0 // indirect
|
||||
github.com/google/go-cmp v0.3.0 // indirect
|
||||
github.com/google/go-github/v25 v25.0.4
|
||||
github.com/google/go-querystring v1.0.0
|
||||
github.com/google/pprof v0.0.0-20190515194954-54271f7e092f // indirect
|
||||
github.com/gorilla/mux v1.7.1 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.9.0 // indirect
|
||||
github.com/hashicorp/golang-lru v0.5.1 // indirect
|
||||
github.com/gdamore/tcell v1.4.0
|
||||
github.com/go-ole/go-ole v1.2.4 // indirect
|
||||
github.com/godbus/dbus v4.1.0+incompatible // indirect
|
||||
github.com/google/go-github/v32 v32.1.0
|
||||
github.com/gophercloud/gophercloud v0.5.0 // indirect
|
||||
github.com/hekmon/cunits v2.0.1+incompatible // indirect
|
||||
github.com/hekmon/transmissionrpc v0.0.0-20190525133028-1d589625bacd
|
||||
github.com/jedib0t/go-pretty/v6 v6.1.0
|
||||
github.com/jessevdk/go-flags v1.4.0
|
||||
github.com/kisielk/errcheck v1.2.0 // indirect
|
||||
github.com/kisielk/gotool v1.0.0 // indirect
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
|
||||
github.com/kr/pty v1.1.4 // indirect
|
||||
github.com/lucasb-eyer/go-colorful v1.0.2
|
||||
github.com/mattn/go-colorable v0.1.1 // indirect
|
||||
github.com/mattn/go-isatty v0.0.7 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.4
|
||||
github.com/olebedev/config v0.0.0-20180910155717-57f804269e64
|
||||
github.com/onsi/ginkgo v1.8.0 // indirect
|
||||
github.com/onsi/gomega v1.5.0 // indirect
|
||||
github.com/openzipkin/zipkin-go v0.1.6 // indirect
|
||||
github.com/pierrec/lz4 v2.2.3+incompatible // indirect
|
||||
github.com/pkg/errors v0.8.1
|
||||
github.com/pkg/profile v1.3.0
|
||||
github.com/pmezard/go-difflib v1.0.0
|
||||
github.com/prometheus/client_golang v0.9.2 // indirect
|
||||
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 // indirect
|
||||
github.com/prometheus/common v0.4.0 // indirect
|
||||
github.com/prometheus/procfs v0.0.0-20190516134534-5de912679dde // indirect
|
||||
github.com/radovskyb/watcher v1.0.6
|
||||
github.com/rivo/tview v0.0.0-20190324182152-8a9e26fab0ff
|
||||
github.com/rivo/uniseg v0.0.0-20190313204849-f699dde9c340 // indirect
|
||||
github.com/rogpeppe/fastuuid v1.1.0 // indirect
|
||||
github.com/schollz/progressbar/v2 v2.13.0 // indirect
|
||||
github.com/shirou/gopsutil v2.18.12+incompatible
|
||||
github.com/sirupsen/logrus v1.4.1 // indirect
|
||||
github.com/sticreations/spotigopher v0.0.0-20181009182052-98632f6f94b0
|
||||
github.com/stretchr/objx v0.2.0 // indirect
|
||||
github.com/stretchr/testify v1.3.0
|
||||
github.com/xanzy/go-gitlab v0.17.0
|
||||
github.com/yfronto/newrelic v0.0.0-20180622232530-7c9c2852e8f9
|
||||
github.com/zmb3/spotify v0.0.0-20180925143944-a4bd83f60e06
|
||||
github.com/zorkian/go-datadog-api v2.20.0+incompatible
|
||||
golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f // indirect
|
||||
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522 // indirect
|
||||
golang.org/x/image v0.0.0-20190516052701-61b8692d9a5c // indirect
|
||||
golang.org/x/lint v0.0.0-20190409202823-959b441ac422 // indirect
|
||||
golang.org/x/mobile v0.0.0-20190509164839-32b2708ab171 // indirect
|
||||
golang.org/x/net v0.0.0-20190514140710-3ec191127204
|
||||
golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a
|
||||
golang.org/x/sys v0.0.0-20190516110030-61b9204099cb
|
||||
golang.org/x/text v0.3.2
|
||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 // indirect
|
||||
golang.org/x/tools v0.0.0-20190516162611-e5f21acdc327 // indirect
|
||||
google.golang.org/api v0.5.0
|
||||
google.golang.org/appengine v1.6.0
|
||||
google.golang.org/genproto v0.0.0-20190515210553-995ef27e003f // indirect
|
||||
google.golang.org/grpc v1.20.1 // indirect
|
||||
gopkg.in/jarcoal/httpmock.v1 v1.0.0-20190314184232-a8ac0a50d0b5 // indirect
|
||||
gopkg.in/yaml.v2 v2.2.2
|
||||
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a // indirect
|
||||
github.com/lib/pq v1.2.0 // indirect
|
||||
github.com/logrusorgru/aurora v0.0.0-20190803045625-94edacc10f9b
|
||||
github.com/microsoft/azure-devops-go-api/azuredevops v0.0.0-20191014190507-26902c1d4325
|
||||
github.com/mmcdole/gofeed v1.1.0
|
||||
github.com/nicklaw5/helix v0.7.0
|
||||
github.com/olebedev/config v0.0.0-20190528211619-364964f3a8e4
|
||||
github.com/olekukonko/tablewriter v0.0.4
|
||||
github.com/onsi/ginkgo v1.12.0 // indirect
|
||||
github.com/onsi/gomega v1.9.0 // indirect
|
||||
github.com/ovh/cds v0.0.0-20201014170613-39429542624d
|
||||
github.com/pborman/uuid v1.2.0 // indirect
|
||||
github.com/piquette/finance-go v1.0.0
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/pkg/profile v1.5.0
|
||||
github.com/radovskyb/watcher v1.0.7
|
||||
github.com/rivo/tview v0.0.0-20200108161608-1316ea7a4b35
|
||||
github.com/shirou/gopsutil v2.20.9+incompatible
|
||||
github.com/shopspring/decimal v1.2.0 // indirect
|
||||
github.com/shurcooL/githubv4 v0.0.0-20200802174311-f27d2ca7f6d5
|
||||
github.com/shurcooL/graphql v0.0.0-20181231061246-d48a9a75455f // indirect
|
||||
github.com/spf13/cobra v0.0.5 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/spf13/viper v1.6.1 // indirect
|
||||
github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf // indirect
|
||||
github.com/stretchr/testify v1.6.1
|
||||
github.com/wtfutil/spotigopher v0.0.0-20191127141047-7d8168fe103a
|
||||
github.com/wtfutil/todoist v0.0.2-0.20191216004217-0ec29ceda61a
|
||||
github.com/xanzy/go-gitlab v0.39.0
|
||||
github.com/zmb3/spotify v0.0.0-20191010212056-e12fb981aacb
|
||||
github.com/zorkian/go-datadog-api v2.30.0+incompatible
|
||||
golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43
|
||||
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208
|
||||
golang.org/x/text v0.3.4
|
||||
google.golang.org/api v0.33.0
|
||||
gopkg.in/jarcoal/httpmock.v1 v1.0.0-20181110093347-3be5f16b70eb // indirect
|
||||
gopkg.in/yaml.v2 v2.3.0
|
||||
gotest.tools v2.2.0+incompatible
|
||||
jaytaylor.com/html2text v0.0.0-20200412013138-3577fbdbcff7
|
||||
k8s.io/apimachinery v0.0.0-20190223094358-dcb391cde5ca
|
||||
k8s.io/client-go v10.0.0+incompatible
|
||||
)
|
||||
|
||||
// These hacks are in place to work around this bug in coreos/etcd/proxy/grpcproxy > v1.30.0 that fails
|
||||
// with this error:
|
||||
//
|
||||
// google.golang.org/grpc/naming: module google.golang.org/grpc@latest found (v1.31.1), but does not contain package google.golang.org/grpc/naming
|
||||
//
|
||||
// See here for more details: https://github.com/etcd-io/etcd/issues/12124
|
||||
replace google.golang.org/grpc v1.30.0 => google.golang.org/grpc v1.29.1
|
||||
|
||||
replace google.golang.org/grpc v1.31.0 => google.golang.org/grpc v1.29.1
|
||||
|
25
help/help.go
25
help/help.go
@ -4,22 +4,37 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/olebedev/config"
|
||||
"github.com/wtfutil/wtf/maker"
|
||||
"github.com/wtfutil/wtf/app"
|
||||
"github.com/wtfutil/wtf/utils"
|
||||
)
|
||||
|
||||
func Display(moduleName string, config *config.Config) {
|
||||
// Display displays the output of the --help argument
|
||||
func Display(moduleName string, cfg *config.Config) {
|
||||
if moduleName == "" {
|
||||
fmt.Println("\n --module takes a module name as an argument, i.e: '--module=github'")
|
||||
} else {
|
||||
fmt.Printf("%s\n", helpFor(moduleName, config))
|
||||
fmt.Printf("%s\n", helpFor(moduleName, cfg))
|
||||
}
|
||||
}
|
||||
|
||||
func helpFor(moduleName string, config *config.Config) string {
|
||||
widget := maker.MakeWidget(nil, nil, moduleName, moduleName, config, config)
|
||||
func helpFor(moduleName string, cfg *config.Config) string {
|
||||
err := cfg.Set("wtf.mods."+moduleName+".enabled", true)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
|
||||
widget := app.MakeWidget(nil, nil, moduleName, cfg)
|
||||
|
||||
// Since we are forcing enabled config, if no module
|
||||
// exists, we will get the unknown one
|
||||
if widget.CommonSettings().Title == "Unknown" {
|
||||
return "Unable to find module " + moduleName
|
||||
}
|
||||
|
||||
result := ""
|
||||
result += utils.StripColorTags(widget.HelpText())
|
||||
result += "\n"
|
||||
result += "Configuration Attributes"
|
||||
result += widget.ConfigText()
|
||||
return result
|
||||
}
|
||||
|
BIN
images/logo_transparent.png
Normal file
BIN
images/logo_transparent.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 59 KiB |
@ -4,8 +4,6 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/wtfutil/wtf/utils"
|
||||
)
|
||||
|
||||
/* -------------------- Exported Functions -------------------- */
|
||||
@ -19,7 +17,7 @@ func Log(msg string) {
|
||||
if err != nil {
|
||||
log.Fatalf("error opening file: %v", err)
|
||||
}
|
||||
defer f.Close()
|
||||
defer func() { _ = f.Close() }()
|
||||
|
||||
log.SetOutput(f)
|
||||
log.Println(msg)
|
||||
@ -30,7 +28,7 @@ func LogFileMissing() bool {
|
||||
}
|
||||
|
||||
func LogFilePath() string {
|
||||
dir, err := utils.Home()
|
||||
dir, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
|
163
main.go
163
main.go
@ -1,170 +1,65 @@
|
||||
package main
|
||||
|
||||
// Generators
|
||||
// To generate the skeleton for a new TextWidget use 'WTF_WIDGET_NAME=MySuperAwesomeWidget go generate -run=text
|
||||
//go:generate -command text go run generator/textwidget.go
|
||||
//go:generate text
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/gdamore/tcell"
|
||||
// Blank import of tzdata embeds the timezone database to allow Windows hosts to find timezone
|
||||
// information even if the timezone database is not available on the local system. See release
|
||||
// notes at https://golang.org/doc/go1.15#time/tzdata for details. This prevents "no timezone
|
||||
// data available" errors in clocks module.
|
||||
_ "time/tzdata"
|
||||
|
||||
"github.com/logrusorgru/aurora"
|
||||
"github.com/pkg/profile"
|
||||
"github.com/radovskyb/watcher"
|
||||
"github.com/rivo/tview"
|
||||
|
||||
"github.com/wtfutil/wtf/app"
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
"github.com/wtfutil/wtf/flags"
|
||||
"github.com/wtfutil/wtf/maker"
|
||||
"github.com/wtfutil/wtf/utils"
|
||||
"github.com/wtfutil/wtf/wtf"
|
||||
)
|
||||
|
||||
var focusTracker wtf.FocusTracker
|
||||
var runningWidgets []wtf.Wtfable
|
||||
|
||||
var (
|
||||
commit = "dev"
|
||||
date = "dev"
|
||||
version = "dev"
|
||||
)
|
||||
|
||||
/* -------------------- Functions -------------------- */
|
||||
|
||||
func disableAllWidgets(widgets []wtf.Wtfable) {
|
||||
for _, widget := range widgets {
|
||||
widget.Disable()
|
||||
}
|
||||
}
|
||||
|
||||
func keyboardIntercept(event *tcell.EventKey) *tcell.EventKey {
|
||||
// These keys are global keys used by the app. Widgets should not implement these keys
|
||||
switch event.Key() {
|
||||
case tcell.KeyCtrlR:
|
||||
refreshAllWidgets(runningWidgets)
|
||||
return nil
|
||||
case tcell.KeyTab:
|
||||
focusTracker.Next()
|
||||
return nil
|
||||
case tcell.KeyBacktab:
|
||||
focusTracker.Prev()
|
||||
return nil
|
||||
case tcell.KeyEsc:
|
||||
focusTracker.None()
|
||||
return nil
|
||||
}
|
||||
|
||||
// This function checks to see if any widget has been assigned the pressed key as its
|
||||
// focus key
|
||||
if focusTracker.FocusOn(string(event.Rune())) {
|
||||
return nil
|
||||
}
|
||||
|
||||
// If no specific widget has focus, then allow the key presses to fall through to the app
|
||||
if !focusTracker.IsFocused {
|
||||
switch string(event.Rune()) {
|
||||
case "/":
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
return event
|
||||
}
|
||||
|
||||
func refreshAllWidgets(widgets []wtf.Wtfable) {
|
||||
for _, widget := range widgets {
|
||||
go widget.Refresh()
|
||||
}
|
||||
}
|
||||
|
||||
func watchForConfigChanges(app *tview.Application, configFilePath string, grid *tview.Grid, pages *tview.Pages) {
|
||||
watch := watcher.New()
|
||||
absPath, _ := utils.ExpandHomeDir(configFilePath)
|
||||
|
||||
// Notify write events
|
||||
watch.FilterOps(watcher.Write)
|
||||
|
||||
go func() {
|
||||
for {
|
||||
select {
|
||||
case <-watch.Event:
|
||||
// Disable all widgets to stop scheduler goroutines and remove widgets from memory
|
||||
disableAllWidgets(runningWidgets)
|
||||
|
||||
config := cfg.LoadConfigFile(absPath)
|
||||
|
||||
widgets := maker.MakeWidgets(app, pages, config)
|
||||
wtf.ValidateWidgets(widgets)
|
||||
runningWidgets = widgets
|
||||
|
||||
focusTracker = wtf.NewFocusTracker(app, widgets, config)
|
||||
|
||||
display := wtf.NewDisplay(widgets, config)
|
||||
pages.AddPage("grid", display.Grid, true, true)
|
||||
case err := <-watch.Error:
|
||||
log.Fatalln(err)
|
||||
case <-watch.Closed:
|
||||
return
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
// Watch config file for changes.
|
||||
if err := watch.Add(absPath); err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
// Start the watching process - it'll check for changes every 100ms.
|
||||
if err := watch.Start(time.Millisecond * 100); err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------- Main -------------------- */
|
||||
|
||||
func main() {
|
||||
log.SetFlags(log.LstdFlags | log.Lshortfile)
|
||||
|
||||
// Parse and handle flags
|
||||
flags := flags.NewFlags()
|
||||
flags.Parse()
|
||||
config := cfg.LoadConfigFile(flags.ConfigFilePath())
|
||||
flags.Display(version, config)
|
||||
|
||||
cfg.MigrateOldConfig()
|
||||
cfg.CreateConfigDir()
|
||||
cfg.CreateConfigFile()
|
||||
// Load the configuration file
|
||||
cfg.Initialize(flags.HasCustomConfig())
|
||||
config := cfg.LoadWtfConfigFile(flags.ConfigFilePath())
|
||||
|
||||
wtf.SetTerminal(config)
|
||||
|
||||
flags.RenderIf(version, date, config)
|
||||
|
||||
if flags.Profile {
|
||||
defer profile.Start(profile.MemProfile).Stop()
|
||||
}
|
||||
|
||||
err := os.Setenv("TERM", config.UString("wtf.term", os.Getenv("TERM")))
|
||||
openFileUtil := config.UString("wtf.openFileUtil", "open")
|
||||
openURLUtil := utils.ToStrs(config.UList("wtf.openUrlUtil", []interface{}{}))
|
||||
utils.Init(openFileUtil, openURLUtil)
|
||||
|
||||
/* Initialize the App Manager */
|
||||
appMan := app.NewAppManager()
|
||||
appMan.MakeNewWtfApp(config, flags.Config)
|
||||
|
||||
currentApp, err := appMan.Current()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
wtf.OpenFileUtil = config.UString("wtf.openFileUtil", "open")
|
||||
|
||||
app := tview.NewApplication()
|
||||
pages := tview.NewPages()
|
||||
|
||||
widgets := maker.MakeWidgets(app, pages, config)
|
||||
wtf.ValidateWidgets(widgets)
|
||||
runningWidgets = widgets
|
||||
|
||||
focusTracker = wtf.NewFocusTracker(app, widgets, config)
|
||||
|
||||
display := wtf.NewDisplay(widgets, config)
|
||||
pages.AddPage("grid", display.Grid, true, true)
|
||||
|
||||
app.SetInputCapture(keyboardIntercept)
|
||||
|
||||
go watchForConfigChanges(app, flags.Config, display.Grid, pages)
|
||||
|
||||
if err := app.SetRoot(pages, true).Run(); err != nil {
|
||||
fmt.Printf("Error: %v\n", err)
|
||||
fmt.Printf("\n%s %v\n", aurora.Red("ERROR"), err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
currentApp.Run()
|
||||
}
|
||||
|
@ -1,225 +0,0 @@
|
||||
package maker
|
||||
|
||||
import (
|
||||
"github.com/olebedev/config"
|
||||
"github.com/rivo/tview"
|
||||
"github.com/wtfutil/wtf/modules/bamboohr"
|
||||
"github.com/wtfutil/wtf/modules/bargraph"
|
||||
"github.com/wtfutil/wtf/modules/circleci"
|
||||
"github.com/wtfutil/wtf/modules/clocks"
|
||||
"github.com/wtfutil/wtf/modules/cmdrunner"
|
||||
"github.com/wtfutil/wtf/modules/cryptoexchanges/bittrex"
|
||||
"github.com/wtfutil/wtf/modules/cryptoexchanges/blockfolio"
|
||||
"github.com/wtfutil/wtf/modules/cryptoexchanges/cryptolive"
|
||||
"github.com/wtfutil/wtf/modules/datadog"
|
||||
"github.com/wtfutil/wtf/modules/gcal"
|
||||
"github.com/wtfutil/wtf/modules/gerrit"
|
||||
"github.com/wtfutil/wtf/modules/git"
|
||||
"github.com/wtfutil/wtf/modules/github"
|
||||
"github.com/wtfutil/wtf/modules/gitlab"
|
||||
"github.com/wtfutil/wtf/modules/gitter"
|
||||
"github.com/wtfutil/wtf/modules/gspreadsheets"
|
||||
"github.com/wtfutil/wtf/modules/hackernews"
|
||||
"github.com/wtfutil/wtf/modules/hibp"
|
||||
"github.com/wtfutil/wtf/modules/ipaddresses/ipapi"
|
||||
"github.com/wtfutil/wtf/modules/ipaddresses/ipinfo"
|
||||
"github.com/wtfutil/wtf/modules/jenkins"
|
||||
"github.com/wtfutil/wtf/modules/jira"
|
||||
"github.com/wtfutil/wtf/modules/logger"
|
||||
"github.com/wtfutil/wtf/modules/mercurial"
|
||||
"github.com/wtfutil/wtf/modules/nbascore"
|
||||
"github.com/wtfutil/wtf/modules/newrelic"
|
||||
"github.com/wtfutil/wtf/modules/opsgenie"
|
||||
"github.com/wtfutil/wtf/modules/pagerduty"
|
||||
"github.com/wtfutil/wtf/modules/power"
|
||||
"github.com/wtfutil/wtf/modules/resourceusage"
|
||||
"github.com/wtfutil/wtf/modules/rollbar"
|
||||
"github.com/wtfutil/wtf/modules/security"
|
||||
"github.com/wtfutil/wtf/modules/spotify"
|
||||
"github.com/wtfutil/wtf/modules/spotifyweb"
|
||||
"github.com/wtfutil/wtf/modules/status"
|
||||
"github.com/wtfutil/wtf/modules/textfile"
|
||||
"github.com/wtfutil/wtf/modules/todo"
|
||||
"github.com/wtfutil/wtf/modules/todoist"
|
||||
"github.com/wtfutil/wtf/modules/travisci"
|
||||
"github.com/wtfutil/wtf/modules/trello"
|
||||
"github.com/wtfutil/wtf/modules/twitter"
|
||||
"github.com/wtfutil/wtf/modules/unknown"
|
||||
"github.com/wtfutil/wtf/modules/victorops"
|
||||
"github.com/wtfutil/wtf/modules/weatherservices/prettyweather"
|
||||
"github.com/wtfutil/wtf/modules/weatherservices/weather"
|
||||
"github.com/wtfutil/wtf/modules/zendesk"
|
||||
"github.com/wtfutil/wtf/wtf"
|
||||
)
|
||||
|
||||
func MakeWidget(
|
||||
app *tview.Application,
|
||||
pages *tview.Pages,
|
||||
widgetName string,
|
||||
widgetType string,
|
||||
moduleConfig *config.Config,
|
||||
globalConfig *config.Config,
|
||||
) wtf.Wtfable {
|
||||
var widget wtf.Wtfable
|
||||
|
||||
// Always in alphabetical order
|
||||
switch widgetType {
|
||||
case "bamboohr":
|
||||
settings := bamboohr.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = bamboohr.NewWidget(app, settings)
|
||||
case "bargraph":
|
||||
settings := bargraph.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = bargraph.NewWidget(app, settings)
|
||||
case "bittrex":
|
||||
settings := bittrex.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = bittrex.NewWidget(app, settings)
|
||||
case "blockfolio":
|
||||
settings := blockfolio.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = blockfolio.NewWidget(app, settings)
|
||||
case "circleci":
|
||||
settings := circleci.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = circleci.NewWidget(app, settings)
|
||||
case "clocks":
|
||||
settings := clocks.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = clocks.NewWidget(app, settings)
|
||||
case "cmdrunner":
|
||||
settings := cmdrunner.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = cmdrunner.NewWidget(app, settings)
|
||||
case "cryptolive":
|
||||
settings := cryptolive.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = cryptolive.NewWidget(app, settings)
|
||||
case "datadog":
|
||||
settings := datadog.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = datadog.NewWidget(app, pages, settings)
|
||||
case "gcal":
|
||||
settings := gcal.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = gcal.NewWidget(app, settings)
|
||||
case "gerrit":
|
||||
settings := gerrit.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = gerrit.NewWidget(app, pages, settings)
|
||||
case "git":
|
||||
settings := git.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = git.NewWidget(app, pages, settings)
|
||||
case "github":
|
||||
settings := github.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = github.NewWidget(app, pages, settings)
|
||||
case "gitlab":
|
||||
settings := gitlab.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = gitlab.NewWidget(app, pages, settings)
|
||||
case "gitter":
|
||||
settings := gitter.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = gitter.NewWidget(app, pages, settings)
|
||||
case "gspreadsheets":
|
||||
settings := gspreadsheets.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = gspreadsheets.NewWidget(app, settings)
|
||||
case "hackernews":
|
||||
settings := hackernews.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = hackernews.NewWidget(app, pages, settings)
|
||||
case "hibp":
|
||||
settings := hibp.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = hibp.NewWidget(app, settings)
|
||||
case "ipapi":
|
||||
settings := ipapi.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = ipapi.NewWidget(app, settings)
|
||||
case "ipinfo":
|
||||
settings := ipinfo.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = ipinfo.NewWidget(app, settings)
|
||||
case "jenkins":
|
||||
settings := jenkins.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = jenkins.NewWidget(app, pages, settings)
|
||||
case "jira":
|
||||
settings := jira.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = jira.NewWidget(app, pages, settings)
|
||||
case "logger":
|
||||
settings := logger.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = logger.NewWidget(app, settings)
|
||||
case "mercurial":
|
||||
settings := mercurial.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = mercurial.NewWidget(app, pages, settings)
|
||||
case "nbascore":
|
||||
settings := nbascore.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = nbascore.NewWidget(app, pages, settings)
|
||||
case "newrelic":
|
||||
settings := newrelic.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = newrelic.NewWidget(app, settings)
|
||||
case "opsgenie":
|
||||
settings := opsgenie.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = opsgenie.NewWidget(app, settings)
|
||||
case "pagerduty":
|
||||
settings := pagerduty.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = pagerduty.NewWidget(app, settings)
|
||||
case "power":
|
||||
settings := power.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = power.NewWidget(app, settings)
|
||||
case "prettyweather":
|
||||
settings := prettyweather.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = prettyweather.NewWidget(app, settings)
|
||||
case "resourceusage":
|
||||
settings := resourceusage.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = resourceusage.NewWidget(app, settings)
|
||||
case "rollbar":
|
||||
settings := rollbar.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = rollbar.NewWidget(app, pages, settings)
|
||||
case "security":
|
||||
settings := security.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = security.NewWidget(app, settings)
|
||||
case "spotify":
|
||||
settings := spotify.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = spotify.NewWidget(app, pages, settings)
|
||||
case "spotifyweb":
|
||||
settings := spotifyweb.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = spotifyweb.NewWidget(app, pages, settings)
|
||||
case "status":
|
||||
settings := status.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = status.NewWidget(app, settings)
|
||||
case "textfile":
|
||||
settings := textfile.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = textfile.NewWidget(app, pages, settings)
|
||||
case "todo":
|
||||
settings := todo.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = todo.NewWidget(app, pages, settings)
|
||||
case "todoist":
|
||||
settings := todoist.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = todoist.NewWidget(app, pages, settings)
|
||||
case "travisci":
|
||||
settings := travisci.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = travisci.NewWidget(app, pages, settings)
|
||||
case "trello":
|
||||
settings := trello.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = trello.NewWidget(app, settings)
|
||||
case "twitter":
|
||||
settings := twitter.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = twitter.NewWidget(app, pages, settings)
|
||||
case "victorops":
|
||||
settings := victorops.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = victorops.NewWidget(app, settings)
|
||||
case "weather":
|
||||
settings := weather.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = weather.NewWidget(app, pages, settings)
|
||||
case "zendesk":
|
||||
settings := zendesk.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = zendesk.NewWidget(app, pages, settings)
|
||||
default:
|
||||
settings := unknown.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
widget = unknown.NewWidget(app, settings)
|
||||
}
|
||||
|
||||
return widget
|
||||
}
|
||||
|
||||
func MakeWidgets(app *tview.Application, pages *tview.Pages, config *config.Config) []wtf.Wtfable {
|
||||
widgets := []wtf.Wtfable{}
|
||||
|
||||
mods, _ := config.Map("wtf.mods")
|
||||
|
||||
for mod := range mods {
|
||||
modConfig, _ := config.Get("wtf.mods." + mod)
|
||||
widgetType := modConfig.UString("type", mod)
|
||||
if enabled := modConfig.UBool("enabled", false); enabled {
|
||||
widget := MakeWidget(app, pages, mod, widgetType, modConfig, config)
|
||||
widgets = append(widgets, widget)
|
||||
}
|
||||
}
|
||||
|
||||
return widgets
|
||||
}
|
280
modules/asana/client.go
Normal file
280
modules/asana/client.go
Normal file
@ -0,0 +1,280 @@
|
||||
package asana
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
asana "bitbucket.org/mikehouston/asana-go"
|
||||
)
|
||||
|
||||
func fetchTasksFromProject(token, projectId, mode string) ([]*TaskItem, error) {
|
||||
taskItems := []*TaskItem{}
|
||||
uidToName := make(map[string]string)
|
||||
|
||||
client := asana.NewClientWithAccessToken(token)
|
||||
|
||||
uid, err := getCurrentUserId(client, mode)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
q := &asana.TaskQuery{
|
||||
Project: projectId,
|
||||
}
|
||||
|
||||
fetchedTasks, _, err := getTasksFromAsana(client, q)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error fetching tasks: %s", err)
|
||||
}
|
||||
|
||||
processFetchedTasks(client, &fetchedTasks, &taskItems, &uidToName, mode, projectId, uid)
|
||||
|
||||
return taskItems, nil
|
||||
}
|
||||
|
||||
func fetchTasksFromProjectSections(token, projectId string, sections []string, mode string) ([]*TaskItem, error) {
|
||||
taskItems := []*TaskItem{}
|
||||
uidToName := make(map[string]string)
|
||||
|
||||
client := asana.NewClientWithAccessToken(token)
|
||||
|
||||
uid, err := getCurrentUserId(client, mode)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
p := &asana.Project{
|
||||
ID: projectId,
|
||||
}
|
||||
|
||||
for _, section := range sections {
|
||||
|
||||
sectionId, err := findSection(client, p, section)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error fetching tasks: %s", err)
|
||||
}
|
||||
|
||||
q := &asana.TaskQuery{
|
||||
Section: sectionId,
|
||||
}
|
||||
|
||||
fetchedTasks, _, err := getTasksFromAsana(client, q)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error fetching tasks: %s", err)
|
||||
}
|
||||
|
||||
if len(fetchedTasks) > 0 {
|
||||
taskItem := &TaskItem{
|
||||
name: section,
|
||||
taskType: TASK_SECTION,
|
||||
}
|
||||
|
||||
taskItems = append(taskItems, taskItem)
|
||||
}
|
||||
|
||||
processFetchedTasks(client, &fetchedTasks, &taskItems, &uidToName, mode, projectId, uid)
|
||||
|
||||
}
|
||||
|
||||
return taskItems, nil
|
||||
}
|
||||
|
||||
func fetchTasksFromWorkspace(token, workspaceId, mode string) ([]*TaskItem, error) {
|
||||
taskItems := []*TaskItem{}
|
||||
uidToName := make(map[string]string)
|
||||
|
||||
client := asana.NewClientWithAccessToken(token)
|
||||
|
||||
uid, err := getCurrentUserId(client, mode)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
q := &asana.TaskQuery{
|
||||
Workspace: workspaceId,
|
||||
Assignee: "me",
|
||||
}
|
||||
|
||||
fetchedTasks, _, err := getTasksFromAsana(client, q)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error fetching tasks: %s", err)
|
||||
}
|
||||
|
||||
processFetchedTasks(client, &fetchedTasks, &taskItems, &uidToName, mode, workspaceId, uid)
|
||||
|
||||
return taskItems, nil
|
||||
|
||||
}
|
||||
|
||||
func toggleTaskCompletionById(token, taskId string) error {
|
||||
client := asana.NewClientWithAccessToken(token)
|
||||
|
||||
t := &asana.Task{
|
||||
ID: taskId,
|
||||
}
|
||||
|
||||
err := t.Fetch(client)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error fetching task: %s", err)
|
||||
}
|
||||
|
||||
updateReq := &asana.UpdateTaskRequest{}
|
||||
|
||||
if *t.Completed {
|
||||
f := false
|
||||
updateReq.Completed = &f
|
||||
} else {
|
||||
t := true
|
||||
updateReq.Completed = &t
|
||||
}
|
||||
|
||||
err = t.Update(client, updateReq)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error updating task: %s", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func processFetchedTasks(client *asana.Client, fetchedTasks *[]*asana.Task, taskItems *[]*TaskItem, uidToName *map[string]string, mode, projectId, uid string) {
|
||||
|
||||
for _, task := range *fetchedTasks {
|
||||
switch {
|
||||
case strings.HasSuffix(mode, "_all"):
|
||||
if task.Assignee != nil {
|
||||
// Check if we have already looked up this user
|
||||
if assigneeName, ok := (*uidToName)[task.Assignee.ID]; ok {
|
||||
task.Assignee.Name = assigneeName
|
||||
} else {
|
||||
// We haven't looked up this user before, perform the lookup now
|
||||
assigneeName, err := getOtherUserEmail(client, task.Assignee.ID)
|
||||
if err != nil {
|
||||
task.Assignee.Name = "Error"
|
||||
}
|
||||
(*uidToName)[task.Assignee.ID] = assigneeName
|
||||
task.Assignee.Name = assigneeName
|
||||
}
|
||||
} else {
|
||||
task.Assignee = &asana.User{
|
||||
Name: "Unassigned",
|
||||
}
|
||||
}
|
||||
taskItem := buildTaskItem(task, projectId)
|
||||
(*taskItems) = append((*taskItems), taskItem)
|
||||
case !strings.HasSuffix(mode, "_all") && task.Assignee != nil && task.Assignee.ID == uid:
|
||||
taskItem := buildTaskItem(task, projectId)
|
||||
(*taskItems) = append((*taskItems), taskItem)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func buildTaskItem(task *asana.Task, projectId string) *TaskItem {
|
||||
dueOnString := ""
|
||||
if task.DueOn != nil {
|
||||
dueOn := time.Time(*task.DueOn)
|
||||
currentYear, _, _ := time.Now().Date()
|
||||
if currentYear != dueOn.Year() {
|
||||
dueOnString = dueOn.Format("Jan 2 2006")
|
||||
} else {
|
||||
dueOnString = dueOn.Format("Jan 2")
|
||||
}
|
||||
}
|
||||
|
||||
assignString := ""
|
||||
if task.Assignee != nil {
|
||||
assignString = task.Assignee.Name
|
||||
}
|
||||
|
||||
taskItem := &TaskItem{
|
||||
name: task.Name,
|
||||
id: task.ID,
|
||||
numSubtasks: task.NumSubtasks,
|
||||
dueOn: dueOnString,
|
||||
url: fmt.Sprintf("https://app.asana.com/0/%s/%s/f", projectId, task.ID),
|
||||
taskType: TASK_TYPE,
|
||||
completed: *task.Completed,
|
||||
assignee: assignString,
|
||||
}
|
||||
|
||||
return taskItem
|
||||
|
||||
}
|
||||
|
||||
func getOtherUserEmail(client *asana.Client, uid string) (string, error) {
|
||||
if uid == "" {
|
||||
return "", fmt.Errorf("missing uid")
|
||||
}
|
||||
|
||||
u := &asana.User{
|
||||
ID: uid,
|
||||
}
|
||||
|
||||
err := u.Fetch(client, nil)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("error fetching user: %s", err)
|
||||
}
|
||||
|
||||
return u.Email, nil
|
||||
}
|
||||
|
||||
func getCurrentUserId(client *asana.Client, mode string) (string, error) {
|
||||
if strings.HasSuffix(mode, "_all") {
|
||||
return "", nil
|
||||
}
|
||||
u, err := client.CurrentUser()
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("error getting current user: %s", err)
|
||||
}
|
||||
|
||||
return u.ID, nil
|
||||
}
|
||||
|
||||
func findSection(client *asana.Client, project *asana.Project, sectionName string) (string, error) {
|
||||
sectionId := ""
|
||||
|
||||
sections, _, err := project.Sections(client, &asana.Options{
|
||||
Limit: 100,
|
||||
})
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("error getting sections: %s", err)
|
||||
}
|
||||
|
||||
for _, section := range sections {
|
||||
if section.Name == sectionName {
|
||||
sectionId = section.ID
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if sectionId == "" {
|
||||
return "", fmt.Errorf("we didn't find the section %s", sectionName)
|
||||
}
|
||||
|
||||
return sectionId, nil
|
||||
}
|
||||
|
||||
func getTasksFromAsana(client *asana.Client, q *asana.TaskQuery) ([]*asana.Task, bool, error) {
|
||||
moreTasks := false
|
||||
|
||||
tasks, np, err := client.QueryTasks(q, &asana.Options{
|
||||
Limit: 100,
|
||||
Fields: []string{
|
||||
"assignee",
|
||||
"name",
|
||||
"num_subtasks",
|
||||
"due_on",
|
||||
"completed",
|
||||
},
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return nil, false, fmt.Errorf("error querying tasks: %s", err)
|
||||
}
|
||||
|
||||
if np != nil {
|
||||
moreTasks = true
|
||||
}
|
||||
|
||||
return tasks, moreTasks, nil
|
||||
}
|
20
modules/asana/keyboard.go
Normal file
20
modules/asana/keyboard.go
Normal file
@ -0,0 +1,20 @@
|
||||
package asana
|
||||
|
||||
import "github.com/gdamore/tcell"
|
||||
|
||||
func (widget *Widget) initializeKeyboardControls() {
|
||||
widget.InitializeHelpTextKeyboardControl(widget.ShowHelp)
|
||||
widget.InitializeRefreshKeyboardControl(widget.Refresh)
|
||||
|
||||
widget.SetKeyboardChar("j", widget.Next, "Select next task")
|
||||
widget.SetKeyboardChar("k", widget.Prev, "Select previous task")
|
||||
widget.SetKeyboardChar("q", widget.Unselect, "Unselect task")
|
||||
widget.SetKeyboardChar("o", widget.openTask, "Open task in browser")
|
||||
widget.SetKeyboardChar("x", widget.toggleTaskCompletion, "Toggles the task's completion state")
|
||||
widget.SetKeyboardChar("?", widget.ShowHelp, "Shows help")
|
||||
|
||||
widget.SetKeyboardKey(tcell.KeyDown, widget.Next, "Select next task")
|
||||
widget.SetKeyboardKey(tcell.KeyUp, widget.Prev, "Select previous task")
|
||||
widget.SetKeyboardKey(tcell.KeyEsc, widget.Unselect, "Unselect task")
|
||||
widget.SetKeyboardKey(tcell.KeyEnter, widget.openTask, "Open task in browser")
|
||||
}
|
48
modules/asana/settings.go
Normal file
48
modules/asana/settings.go
Normal file
@ -0,0 +1,48 @@
|
||||
package asana
|
||||
|
||||
import (
|
||||
"github.com/olebedev/config"
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
"github.com/wtfutil/wtf/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
defaultFocusable = true
|
||||
defaultTitle = "Asana"
|
||||
)
|
||||
|
||||
type Settings struct {
|
||||
*cfg.Common
|
||||
|
||||
projectId string `help:"The Asana Project ID. If the mode is 'project' or 'project_sections' this is required to known which Asana Project to pull your tasks from" values:"A valid Asana Project ID string" optional:"true"`
|
||||
|
||||
workspaceId string `help:"The Asana Workspace ID. If mode is 'workspace' this is required" values:"A valid Asana Workspace ID string" optional:"true"`
|
||||
|
||||
sections []string `help:"The Asana Section Labels to fetch from the Project. Required if the mode is 'project_sections'" values:"An array of Asana Section Label strings" optional:"true"`
|
||||
|
||||
allUsers bool `help:"Fetch tasks for all users, defaults to false" values:"bool" optional:"true"`
|
||||
|
||||
mode string `help:"What mode to query Asana, 'project', 'project_sections', 'workspace'" values:"A string with either 'project', 'project_sections' or 'workspace'"`
|
||||
|
||||
hideComplete bool `help:"Hide completed tasks, defaults to false" values:"bool" optional:"true"`
|
||||
|
||||
apiKey string `help:"Your Asana Personal Access Token. Leave this blank to use the WTF_ASANA_TOKEN environment variable." values:"Your Asana Personal Access Token as a string" optional:"true"`
|
||||
|
||||
token string
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||
settings := Settings{
|
||||
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig,
|
||||
globalConfig),
|
||||
projectId: ymlConfig.UString("projectId", ""),
|
||||
apiKey: ymlConfig.UString("apiKey", ""),
|
||||
workspaceId: ymlConfig.UString("workspaceId", ""),
|
||||
sections: utils.ToStrs(ymlConfig.UList("sections")),
|
||||
allUsers: ymlConfig.UBool("allUsers", false),
|
||||
mode: ymlConfig.UString("mode", ""),
|
||||
hideComplete: ymlConfig.UBool("hideComplete", false),
|
||||
}
|
||||
|
||||
return &settings
|
||||
}
|
259
modules/asana/widget.go
Normal file
259
modules/asana/widget.go
Normal file
@ -0,0 +1,259 @@
|
||||
package asana
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/rivo/tview"
|
||||
"github.com/wtfutil/wtf/utils"
|
||||
"github.com/wtfutil/wtf/view"
|
||||
)
|
||||
|
||||
type TaskType int
|
||||
|
||||
const (
|
||||
TASK_TYPE TaskType = iota
|
||||
TASK_SECTION
|
||||
TASK_BREAK
|
||||
)
|
||||
|
||||
type TaskItem struct {
|
||||
name string
|
||||
numSubtasks int32
|
||||
dueOn string
|
||||
id string
|
||||
url string
|
||||
taskType TaskType
|
||||
completed bool
|
||||
assignee string
|
||||
}
|
||||
|
||||
type Widget struct {
|
||||
view.ScrollableWidget
|
||||
|
||||
tasks []*TaskItem
|
||||
|
||||
mu sync.Mutex
|
||||
err error
|
||||
settings *Settings
|
||||
tviewApp *tview.Application
|
||||
}
|
||||
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := &Widget{
|
||||
ScrollableWidget: view.NewScrollableWidget(tviewApp, pages, settings.Common),
|
||||
|
||||
tviewApp: tviewApp,
|
||||
settings: settings,
|
||||
}
|
||||
|
||||
widget.SetRenderFunction(widget.Render)
|
||||
widget.initializeKeyboardControls()
|
||||
|
||||
return widget
|
||||
}
|
||||
|
||||
/* -------------------- Exported Functions -------------------- */
|
||||
|
||||
func (widget *Widget) Refresh() {
|
||||
widget.tasks = nil
|
||||
widget.err = nil
|
||||
widget.SetItemCount(0)
|
||||
|
||||
widget.mu.Lock()
|
||||
defer widget.mu.Unlock()
|
||||
tasks, err := widget.Fetch(
|
||||
widget.settings.workspaceId,
|
||||
widget.settings.projectId,
|
||||
widget.settings.mode,
|
||||
widget.settings.sections,
|
||||
widget.settings.allUsers,
|
||||
)
|
||||
if err != nil {
|
||||
widget.err = err
|
||||
} else {
|
||||
widget.tasks = tasks
|
||||
widget.SetItemCount(len(tasks))
|
||||
}
|
||||
|
||||
widget.Render()
|
||||
}
|
||||
|
||||
func (widget *Widget) Render() {
|
||||
widget.Redraw(widget.content)
|
||||
}
|
||||
|
||||
func (widget *Widget) Fetch(workspaceId, projectId, mode string, sections []string, allUsers bool) ([]*TaskItem, error) {
|
||||
|
||||
availableModes := map[string]interface{}{
|
||||
"project": nil,
|
||||
"project_sections": nil,
|
||||
"workspace": nil,
|
||||
}
|
||||
|
||||
if _, ok := availableModes[mode]; !ok {
|
||||
return nil, fmt.Errorf("missing mode, or mode is invalid - please set to project, project_sections or workspace")
|
||||
}
|
||||
|
||||
if widget.settings.apiKey != "" {
|
||||
widget.settings.token = widget.settings.apiKey
|
||||
} else {
|
||||
widget.settings.token = os.Getenv("WTF_ASANA_TOKEN")
|
||||
}
|
||||
|
||||
if widget.settings.token == "" {
|
||||
return nil, fmt.Errorf("missing environment variable token or apikey config")
|
||||
}
|
||||
|
||||
subMode := mode
|
||||
if allUsers && mode != "workspace" {
|
||||
subMode += "_all"
|
||||
}
|
||||
|
||||
if projectId == "" && strings.HasPrefix(subMode, "project") {
|
||||
return nil, fmt.Errorf("missing project id")
|
||||
}
|
||||
|
||||
if workspaceId == "" && subMode == "workspace" {
|
||||
return nil, fmt.Errorf("missing workspace id")
|
||||
}
|
||||
|
||||
var tasks []*TaskItem
|
||||
var err error
|
||||
|
||||
switch {
|
||||
case strings.HasPrefix(subMode, "project_sections"):
|
||||
tasks, err = fetchTasksFromProjectSections(widget.settings.token, projectId, sections, subMode)
|
||||
case strings.HasPrefix(subMode, "project"):
|
||||
tasks, err = fetchTasksFromProject(widget.settings.token, projectId, subMode)
|
||||
case subMode == "workspace":
|
||||
tasks, err = fetchTasksFromWorkspace(widget.settings.token, workspaceId, subMode)
|
||||
default:
|
||||
err = fmt.Errorf("no mode found")
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return tasks, nil
|
||||
|
||||
}
|
||||
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
|
||||
func (widget *Widget) content() (string, string, bool) {
|
||||
|
||||
title := widget.CommonSettings().Title
|
||||
if widget.err != nil {
|
||||
return title, widget.err.Error(), true
|
||||
}
|
||||
|
||||
data := widget.tasks
|
||||
if len(data) == 0 {
|
||||
return title, "No data", false
|
||||
}
|
||||
|
||||
var str string
|
||||
|
||||
for idx, taskItem := range data {
|
||||
switch {
|
||||
case taskItem.taskType == TASK_TYPE:
|
||||
if widget.settings.hideComplete && taskItem.completed {
|
||||
continue
|
||||
}
|
||||
|
||||
rowColor := widget.RowColor(idx)
|
||||
|
||||
completed := "[ []"
|
||||
if taskItem.completed {
|
||||
completed = "[x[]"
|
||||
}
|
||||
|
||||
row := ""
|
||||
|
||||
if widget.settings.allUsers && taskItem.assignee != "" {
|
||||
row = fmt.Sprintf(
|
||||
"[%s] %s %s: %s",
|
||||
rowColor,
|
||||
completed,
|
||||
taskItem.assignee,
|
||||
taskItem.name,
|
||||
)
|
||||
} else {
|
||||
row = fmt.Sprintf(
|
||||
"[%s] %s %s",
|
||||
rowColor,
|
||||
completed,
|
||||
taskItem.name,
|
||||
)
|
||||
}
|
||||
|
||||
if taskItem.numSubtasks > 0 {
|
||||
row += fmt.Sprintf(" (%d)", taskItem.numSubtasks)
|
||||
}
|
||||
|
||||
if taskItem.dueOn != "" {
|
||||
row += fmt.Sprintf(" due: %s", taskItem.dueOn)
|
||||
}
|
||||
|
||||
row += " [white]"
|
||||
|
||||
str += utils.HighlightableHelper(widget.View, row, idx, len(taskItem.name))
|
||||
|
||||
case taskItem.taskType == TASK_SECTION:
|
||||
if idx > 1 {
|
||||
row := "[white] "
|
||||
|
||||
str += utils.HighlightableHelper(widget.View, row, idx, len(taskItem.name))
|
||||
}
|
||||
row := fmt.Sprintf(
|
||||
"[white] %s [white]",
|
||||
taskItem.name,
|
||||
)
|
||||
|
||||
str += utils.HighlightableHelper(widget.View, row, idx, len(taskItem.name))
|
||||
|
||||
row = "[white] "
|
||||
|
||||
str += utils.HighlightableHelper(widget.View, row, idx, len(taskItem.name))
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return title, str, false
|
||||
|
||||
}
|
||||
|
||||
func (widget *Widget) openTask() {
|
||||
sel := widget.GetSelected()
|
||||
|
||||
if sel >= 0 && widget.tasks != nil && sel < len(widget.tasks) {
|
||||
task := widget.tasks[sel]
|
||||
if task.taskType == TASK_TYPE && task.url != "" {
|
||||
utils.OpenFile(task.url)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (widget *Widget) toggleTaskCompletion() {
|
||||
sel := widget.GetSelected()
|
||||
|
||||
if sel >= 0 && widget.tasks != nil && sel < len(widget.tasks) {
|
||||
task := widget.tasks[sel]
|
||||
if task.taskType == TASK_TYPE {
|
||||
widget.mu.Lock()
|
||||
|
||||
err := toggleTaskCompletionById(widget.settings.token, task.id)
|
||||
if err != nil {
|
||||
widget.err = err
|
||||
}
|
||||
|
||||
widget.mu.Unlock()
|
||||
widget.Refresh()
|
||||
}
|
||||
}
|
||||
}
|
59
modules/azuredevops/client.go
Normal file
59
modules/azuredevops/client.go
Normal file
@ -0,0 +1,59 @@
|
||||
package azuredevops
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
azrBuild "github.com/microsoft/azure-devops-go-api/azuredevops/build"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func (widget *Widget) getBuildStats() string {
|
||||
projName := widget.settings.projectName
|
||||
statusFilter := azrBuild.BuildStatusValues.All
|
||||
top := widget.settings.maxRows
|
||||
builds, err := widget.cli.GetBuilds(widget.ctx, azrBuild.GetBuildsArgs{Project: &projName, StatusFilter: &statusFilter, Top: &top})
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "could not get builds").Error()
|
||||
}
|
||||
|
||||
result := ""
|
||||
for _, build := range builds.Value {
|
||||
num := *build.BuildNumber
|
||||
branch := *build.SourceBranch
|
||||
reason := *build.Reason
|
||||
triggers := *build.TriggerInfo
|
||||
if reason == azrBuild.BuildReasonValues.PullRequest {
|
||||
branch = triggers["pr.sourceBranch"]
|
||||
}
|
||||
branch = strings.TrimPrefix(branch, "refs/heads/")
|
||||
status := *build.Status
|
||||
statusDisplay := "[white:grey]unknown"
|
||||
if status == azrBuild.BuildStatusValues.InProgress {
|
||||
statusDisplay = "[white:blue]in progress"
|
||||
} else if status == azrBuild.BuildStatusValues.Cancelling {
|
||||
statusDisplay = "[white:orange]in cancelling"
|
||||
} else if (status == azrBuild.BuildStatusValues.Postponed) || (status == azrBuild.BuildStatusValues.NotStarted) {
|
||||
statusDisplay = "[white:blue]waiting"
|
||||
} else if status == azrBuild.BuildStatusValues.Completed {
|
||||
buildResult := *build.Result
|
||||
if buildResult == azrBuild.BuildResultValues.Succeeded {
|
||||
statusDisplay = "[white:green]succeeded"
|
||||
} else if buildResult == azrBuild.BuildResultValues.Failed {
|
||||
statusDisplay = "[white:red]failed"
|
||||
} else if buildResult == azrBuild.BuildResultValues.Canceled {
|
||||
statusDisplay = "[white:darkgrey]cancelled"
|
||||
} else if buildResult == azrBuild.BuildResultValues.PartiallySucceeded {
|
||||
statusDisplay = "[white:magenta]partially"
|
||||
}
|
||||
}
|
||||
|
||||
result += fmt.Sprintf("%s[-:-:-] #%s %s (%s) \n", statusDisplay, num, branch, reason)
|
||||
}
|
||||
|
||||
if result == "" {
|
||||
result = "no builds found"
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
42
modules/azuredevops/example-conf.yml
Normal file
42
modules/azuredevops/example-conf.yml
Normal file
@ -0,0 +1,42 @@
|
||||
wtf:
|
||||
colors:
|
||||
# background: black
|
||||
# foreground: blue
|
||||
border:
|
||||
focusable: darkslateblue
|
||||
focused: orange
|
||||
normal: gray
|
||||
checked: yellow
|
||||
highlight:
|
||||
fore: black
|
||||
back: gray
|
||||
rows:
|
||||
even: yellow
|
||||
odd: white
|
||||
grid:
|
||||
# How _wide_ the columns are, in terminal characters. In this case we have
|
||||
# four columns, each of which are 35 characters wide.
|
||||
# columns: [50, ]
|
||||
# How _high_ the rows are, in terminal lines. In this case we have four rows
|
||||
# that support ten line of text and one of four.
|
||||
# rows: [50]
|
||||
refreshInterval: 1
|
||||
openFileUtil: "open"
|
||||
mods:
|
||||
azuredevops:
|
||||
type: azuredevops
|
||||
title: "💻"
|
||||
enabled: true
|
||||
position:
|
||||
top: 0
|
||||
left: 0
|
||||
height: 3
|
||||
width: 3
|
||||
refreshInterval: 1
|
||||
labelColor: lightblue # title label color (optional / default: white)
|
||||
apiToken: "mysecret api token" # api key (required)
|
||||
orgUrl: "https://dev.azure.com/myawesomecompany/" # url to your azure devops project (required)
|
||||
prjectName: "the awesome project" # name of your project (required)
|
||||
maxRows: 3 #max rows to show (optional / default 3)
|
||||
|
||||
|
42
modules/azuredevops/settings.go
Normal file
42
modules/azuredevops/settings.go
Normal file
@ -0,0 +1,42 @@
|
||||
package azuredevops
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/olebedev/config"
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const (
|
||||
defaultFocus = false
|
||||
defaultTitle = "azuredevops"
|
||||
)
|
||||
|
||||
// Settings defines the configuration options for this module
|
||||
type Settings struct {
|
||||
*cfg.Common
|
||||
|
||||
apiToken string `help:"Your Azure DevOps Access Token."`
|
||||
labelColor string
|
||||
maxRows int
|
||||
orgURL string `help:"Your Azure DevOps organization URL."`
|
||||
projectName string
|
||||
}
|
||||
|
||||
// NewSettingsFromYAML creates and returns an instance of Settings with configuration options populated
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||
settings := Settings{
|
||||
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocus, ymlConfig, globalConfig),
|
||||
|
||||
apiToken: ymlConfig.UString("apiToken", os.Getenv("WTF_AZURE_DEVOPS_API_TOKEN")),
|
||||
labelColor: ymlConfig.UString("labelColor", "white"),
|
||||
maxRows: ymlConfig.UInt("maxRows", 3),
|
||||
orgURL: ymlConfig.UString("orgURL", os.Getenv("WTF_AZURE_DEVOPS_ORG_URL")),
|
||||
projectName: ymlConfig.UString("projectName", os.Getenv("WTF_AZURE_DEVOPS_PROJECT_NAME")),
|
||||
}
|
||||
|
||||
cfg.ModuleSecret(name, globalConfig, &settings.apiToken).
|
||||
Service(settings.orgURL).Load()
|
||||
|
||||
return &settings
|
||||
}
|
66
modules/azuredevops/widget.go
Normal file
66
modules/azuredevops/widget.go
Normal file
@ -0,0 +1,66 @@
|
||||
package azuredevops
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
azr "github.com/microsoft/azure-devops-go-api/azuredevops"
|
||||
azrBuild "github.com/microsoft/azure-devops-go-api/azuredevops/build"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/rivo/tview"
|
||||
"github.com/wtfutil/wtf/view"
|
||||
)
|
||||
|
||||
type Widget struct {
|
||||
view.TextWidget
|
||||
cli azrBuild.Client
|
||||
settings *Settings
|
||||
displayBuffer string
|
||||
ctx context.Context
|
||||
}
|
||||
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(tviewApp, pages, settings.Common),
|
||||
settings: settings,
|
||||
}
|
||||
|
||||
widget.View.SetScrollable(true)
|
||||
connection := azr.NewPatConnection(settings.orgURL, settings.apiToken)
|
||||
ctx := context.Background()
|
||||
|
||||
cli, err := azrBuild.NewClient(ctx, connection)
|
||||
if err != nil {
|
||||
widget.displayBuffer = errors.Wrap(err, "could not create client 2").Error()
|
||||
} else {
|
||||
widget.cli = cli
|
||||
widget.ctx = ctx
|
||||
}
|
||||
|
||||
widget.refreshDisplayBuffer()
|
||||
|
||||
return &widget
|
||||
}
|
||||
|
||||
func (widget *Widget) Refresh() {
|
||||
widget.refreshDisplayBuffer()
|
||||
widget.Redraw(widget.display)
|
||||
}
|
||||
|
||||
func (widget *Widget) display() (string, string, bool) {
|
||||
return widget.CommonSettings().Title, widget.displayBuffer, true
|
||||
}
|
||||
|
||||
func (widget *Widget) refreshDisplayBuffer() {
|
||||
if widget.cli == nil {
|
||||
return
|
||||
}
|
||||
|
||||
widget.displayBuffer = ""
|
||||
|
||||
widget.displayBuffer += fmt.Sprintf("[%s::bul] build status - %s\n",
|
||||
widget.settings.labelColor,
|
||||
widget.settings.projectName)
|
||||
|
||||
widget.displayBuffer += widget.getBuildStats()
|
||||
}
|
@ -2,7 +2,6 @@ package bamboohr
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
//"time"
|
||||
|
||||
"github.com/wtfutil/wtf/wtf"
|
||||
)
|
||||
|
@ -18,7 +18,7 @@ func Request(apiKey string, apiURL string) ([]byte, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
defer func() { _ = resp.Body.Close() }()
|
||||
|
||||
data, err := ParseBody(resp)
|
||||
if err != nil {
|
||||
|
@ -7,23 +7,27 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const defaultTitle = "BambooHR"
|
||||
const (
|
||||
defaultFocusable = false
|
||||
defaultTitle = "BambooHR"
|
||||
)
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
*cfg.Common
|
||||
|
||||
apiKey string
|
||||
subdomain string
|
||||
apiKey string `help:"Your BambooHR API token."`
|
||||
subdomain string `help:"Your BambooHR API subdomain name."`
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
|
||||
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||
|
||||
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_BAMBOO_HR_TOKEN")),
|
||||
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_BAMBOO_HR_TOKEN"))),
|
||||
subdomain: ymlConfig.UString("subdomain", os.Getenv("WTF_BAMBOO_HR_SUBDOMAIN")),
|
||||
}
|
||||
|
||||
cfg.ModuleSecret(name, globalConfig, &settings.apiKey).Load()
|
||||
|
||||
return &settings
|
||||
}
|
||||
|
@ -2,22 +2,26 @@ package bamboohr
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/rivo/tview"
|
||||
"github.com/wtfutil/wtf/utils"
|
||||
"github.com/wtfutil/wtf/view"
|
||||
"github.com/wtfutil/wtf/wtf"
|
||||
)
|
||||
|
||||
const APIURI = "https://api.bamboohr.com/api/gateway.php"
|
||||
const apiURI = "https://api.bamboohr.com/api/gateway.php"
|
||||
|
||||
type Widget struct {
|
||||
wtf.TextWidget
|
||||
view.TextWidget
|
||||
|
||||
settings *Settings
|
||||
items []Item
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common, false),
|
||||
TextWidget: view.NewTextWidget(tviewApp, nil, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
@ -29,33 +33,33 @@ func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
|
||||
func (widget *Widget) Refresh() {
|
||||
client := NewClient(
|
||||
APIURI,
|
||||
apiURI,
|
||||
widget.settings.apiKey,
|
||||
widget.settings.subdomain,
|
||||
)
|
||||
|
||||
todayItems := client.Away(
|
||||
widget.items = client.Away(
|
||||
"timeOff",
|
||||
wtf.Now().Format(wtf.DateFormat),
|
||||
wtf.Now().Format(wtf.DateFormat),
|
||||
time.Now().Local().Format(wtf.DateFormat),
|
||||
time.Now().Local().Format(wtf.DateFormat),
|
||||
)
|
||||
|
||||
widget.Redraw(widget.CommonSettings.Title, widget.contentFrom(todayItems), false)
|
||||
widget.Redraw(widget.content)
|
||||
}
|
||||
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
|
||||
func (widget *Widget) contentFrom(items []Item) string {
|
||||
if len(items) == 0 {
|
||||
return fmt.Sprintf("\n\n\n\n\n\n\n\n%s", wtf.CenterText("[grey]no one[white]", 50))
|
||||
}
|
||||
|
||||
func (widget *Widget) content() (string, string, bool) {
|
||||
str := ""
|
||||
for _, item := range items {
|
||||
str += widget.format(item)
|
||||
if len(widget.items) == 0 {
|
||||
str = fmt.Sprintf("\n\n\n\n\n\n\n\n%s", utils.CenterText("[grey]no one[white]", 50))
|
||||
} else {
|
||||
for _, item := range widget.items {
|
||||
str += widget.format(item)
|
||||
}
|
||||
}
|
||||
|
||||
return str
|
||||
return widget.CommonSettings().Title, str, false
|
||||
}
|
||||
|
||||
func (widget *Widget) format(item Item) string {
|
||||
|
@ -5,15 +5,18 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const defaultTitle = "Bargraph"
|
||||
const (
|
||||
defaultFocusable = false
|
||||
defaultTitle = "Bargraph"
|
||||
)
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
*cfg.Common
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
|
||||
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||
}
|
||||
|
||||
return &settings
|
||||
|
@ -5,29 +5,27 @@ This is a demo bargraph that just populates some random date/val data
|
||||
*/
|
||||
|
||||
import (
|
||||
"github.com/rivo/tview"
|
||||
"math/rand"
|
||||
"time"
|
||||
|
||||
"github.com/wtfutil/wtf/wtf"
|
||||
)
|
||||
"github.com/rivo/tview"
|
||||
|
||||
var started = false
|
||||
var ok = true
|
||||
"github.com/wtfutil/wtf/view"
|
||||
)
|
||||
|
||||
// Widget define wtf widget to register widget later
|
||||
type Widget struct {
|
||||
wtf.BarGraph
|
||||
view.BarGraph
|
||||
|
||||
app *tview.Application
|
||||
tviewApp *tview.Application
|
||||
}
|
||||
|
||||
// NewWidget Make new instance of widget
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
BarGraph: wtf.NewBarGraph(app, "Sample Bar Graph", settings.common, false),
|
||||
BarGraph: view.NewBarGraph(tviewApp, "Sample Bar Graph", settings.Common),
|
||||
|
||||
app: app,
|
||||
tviewApp: tviewApp,
|
||||
}
|
||||
|
||||
widget.View.SetWrap(true)
|
||||
@ -43,15 +41,16 @@ func MakeGraph(widget *Widget) {
|
||||
|
||||
//this could come from config
|
||||
const lineCount = 8
|
||||
var stats [lineCount]wtf.Bar
|
||||
var stats [lineCount]view.Bar
|
||||
|
||||
barTime := time.Now()
|
||||
for i := 0; i < lineCount; i++ {
|
||||
barTime = barTime.Add(time.Duration(time.Minute))
|
||||
barTime = barTime.Add(time.Minute)
|
||||
|
||||
bar := wtf.Bar{
|
||||
Label: barTime.Format("15:04"),
|
||||
Percent: rand.Intn(100-5) + 5,
|
||||
bar := view.Bar{
|
||||
Label: barTime.Format("15:04"),
|
||||
Percent: rand.Intn(100-5) + 5,
|
||||
LabelColor: "red",
|
||||
}
|
||||
|
||||
stats[i] = bar
|
||||
@ -70,7 +69,7 @@ func (widget *Widget) Refresh() {
|
||||
|
||||
widget.View.Clear()
|
||||
|
||||
widget.app.QueueUpdateDraw(func() {
|
||||
widget.tviewApp.QueueUpdateDraw(func() {
|
||||
display(widget)
|
||||
})
|
||||
|
||||
|
108
modules/buildkite/client.go
Normal file
108
modules/buildkite/client.go
Normal file
@ -0,0 +1,108 @@
|
||||
package buildkite
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/wtfutil/wtf/utils"
|
||||
)
|
||||
|
||||
type Pipeline struct {
|
||||
Slug string `json:"slug"`
|
||||
}
|
||||
|
||||
type Build struct {
|
||||
State string `json:"state"`
|
||||
Pipeline Pipeline `json:"pipeline"`
|
||||
Branch string `json:"branch"`
|
||||
WebUrl string `json:"web_url"`
|
||||
}
|
||||
|
||||
func (widget *Widget) getBuilds() ([]Build, error) {
|
||||
builds := []Build{}
|
||||
|
||||
for _, pipeline := range widget.settings.pipelines {
|
||||
buildsForPipeline, err := widget.recentBuilds(pipeline)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
mostRecent := mostRecentBuildForBranches(buildsForPipeline, pipeline.branches)
|
||||
builds = append(builds, mostRecent...)
|
||||
}
|
||||
|
||||
return builds, nil
|
||||
}
|
||||
|
||||
func (widget *Widget) recentBuilds(pipeline PipelineSettings) ([]Build, error) {
|
||||
url := fmt.Sprintf(
|
||||
"https://api.buildkite.com/v2/organizations/%s/pipelines/%s/builds%s",
|
||||
widget.settings.orgSlug,
|
||||
pipeline.slug,
|
||||
branchesQuery(pipeline.branches),
|
||||
)
|
||||
|
||||
req, err := http.NewRequest("GET", url, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", widget.settings.apiKey))
|
||||
|
||||
httpClient := &http.Client{Transport: &http.Transport{
|
||||
Proxy: http.ProxyFromEnvironment,
|
||||
}}
|
||||
|
||||
resp, err := httpClient.Do(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer func() { _ = resp.Body.Close() }()
|
||||
|
||||
if resp.StatusCode < 200 || resp.StatusCode > 299 {
|
||||
return nil, fmt.Errorf(resp.Status)
|
||||
}
|
||||
|
||||
builds := []Build{}
|
||||
err = utils.ParseJSON(&builds, resp.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return builds, nil
|
||||
}
|
||||
|
||||
func branchesQuery(branches []string) string {
|
||||
if len(branches) == 0 {
|
||||
return ""
|
||||
}
|
||||
|
||||
if len(branches) == 1 {
|
||||
return fmt.Sprintf("?branch=%s", branches[0])
|
||||
}
|
||||
|
||||
queryString := fmt.Sprintf("?branch[]=%s", branches[0])
|
||||
for _, branch := range branches[1:] {
|
||||
queryString += fmt.Sprintf("&branch[]=%s", branch)
|
||||
}
|
||||
|
||||
return queryString
|
||||
}
|
||||
|
||||
func mostRecentBuildForBranches(builds []Build, branches []string) []Build {
|
||||
recentBuilds := []Build{}
|
||||
|
||||
haveMostRecentBuildForBranch := map[string]bool{}
|
||||
for _, branch := range branches {
|
||||
haveMostRecentBuildForBranch[branch] = false
|
||||
}
|
||||
|
||||
for _, build := range builds {
|
||||
if !haveMostRecentBuildForBranch[build.Branch] {
|
||||
haveMostRecentBuildForBranch[build.Branch] = true
|
||||
recentBuilds = append(recentBuilds, build)
|
||||
}
|
||||
}
|
||||
|
||||
return recentBuilds
|
||||
}
|
6
modules/buildkite/keyboard.go
Normal file
6
modules/buildkite/keyboard.go
Normal file
@ -0,0 +1,6 @@
|
||||
package buildkite
|
||||
|
||||
func (widget *Widget) initializeKeyboardControls() {
|
||||
widget.InitializeHelpTextKeyboardControl(widget.ShowHelp)
|
||||
widget.InitializeRefreshKeyboardControl(widget.Refresh)
|
||||
}
|
120
modules/buildkite/pipelines_display_data.go
Normal file
120
modules/buildkite/pipelines_display_data.go
Normal file
@ -0,0 +1,120 @@
|
||||
package buildkite
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type pipelinesDisplayData struct {
|
||||
buildsForPipeline map[string][]Build
|
||||
orderedPipelines []string
|
||||
}
|
||||
|
||||
func (data *pipelinesDisplayData) Content() string {
|
||||
maxPipelineLength := getLongestLength(data.orderedPipelines)
|
||||
|
||||
str := ""
|
||||
for _, pipeline := range data.orderedPipelines {
|
||||
str += fmt.Sprintf("[white]%s", padRight(pipeline, maxPipelineLength))
|
||||
for _, build := range data.buildsForPipeline[pipeline] {
|
||||
str += fmt.Sprintf(" [%s]%s[white]", buildColor(build.State), build.Branch)
|
||||
}
|
||||
str += "\n"
|
||||
}
|
||||
|
||||
return str
|
||||
}
|
||||
|
||||
func NewPipelinesDisplayData(builds []Build) pipelinesDisplayData {
|
||||
grouped := make(map[string][]Build)
|
||||
|
||||
for _, build := range builds {
|
||||
if _, ok := grouped[build.Pipeline.Slug]; ok {
|
||||
grouped[build.Pipeline.Slug] = append(grouped[build.Pipeline.Slug], build)
|
||||
} else {
|
||||
grouped[build.Pipeline.Slug] = []Build{}
|
||||
grouped[build.Pipeline.Slug] = append(grouped[build.Pipeline.Slug], build)
|
||||
}
|
||||
}
|
||||
|
||||
orderedPipelines := make([]string, len(grouped))
|
||||
i := 0
|
||||
for pipeline := range grouped {
|
||||
orderedPipelines[i] = pipeline
|
||||
i++
|
||||
}
|
||||
sort.Strings(orderedPipelines)
|
||||
|
||||
name := func(b1, b2 *Build) bool {
|
||||
return b1.Branch < b2.Branch
|
||||
}
|
||||
for _, builds := range grouped {
|
||||
ByBuild(name).Sort(builds)
|
||||
}
|
||||
|
||||
return pipelinesDisplayData{
|
||||
buildsForPipeline: grouped,
|
||||
orderedPipelines: orderedPipelines,
|
||||
}
|
||||
}
|
||||
|
||||
type ByBuild func(b1, b2 *Build) bool
|
||||
|
||||
func (by ByBuild) Sort(builds []Build) {
|
||||
sorter := &buildSorter{
|
||||
builds: builds,
|
||||
by: by,
|
||||
}
|
||||
sort.Sort(sorter)
|
||||
}
|
||||
|
||||
type buildSorter struct {
|
||||
builds []Build
|
||||
by func(b1, b2 *Build) bool
|
||||
}
|
||||
|
||||
func (bs *buildSorter) Len() int {
|
||||
return len(bs.builds)
|
||||
}
|
||||
|
||||
func (bs *buildSorter) Swap(i, j int) {
|
||||
bs.builds[i], bs.builds[j] = bs.builds[j], bs.builds[i]
|
||||
}
|
||||
|
||||
func (bs *buildSorter) Less(i, j int) bool {
|
||||
return bs.by(&bs.builds[i], &bs.builds[j])
|
||||
}
|
||||
|
||||
func getLongestLength(strs []string) int {
|
||||
longest := 0
|
||||
|
||||
for _, str := range strs {
|
||||
if len(str) > longest {
|
||||
longest = len(str)
|
||||
}
|
||||
}
|
||||
|
||||
return longest
|
||||
}
|
||||
|
||||
func padRight(text string, length int) string {
|
||||
padLength := length - len(text)
|
||||
|
||||
if padLength <= 0 {
|
||||
return text[:length]
|
||||
}
|
||||
|
||||
return text + strings.Repeat(" ", padLength)
|
||||
}
|
||||
|
||||
func buildColor(state string) string {
|
||||
switch state {
|
||||
case "passed":
|
||||
return "green"
|
||||
case "failed":
|
||||
return "red"
|
||||
default:
|
||||
return "yellow"
|
||||
}
|
||||
}
|
66
modules/buildkite/settings.go
Normal file
66
modules/buildkite/settings.go
Normal file
@ -0,0 +1,66 @@
|
||||
package buildkite
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/olebedev/config"
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
"github.com/wtfutil/wtf/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
defaultTitle = "Buildkite"
|
||||
defaultFocusable = true
|
||||
)
|
||||
|
||||
// PipelineSettings defines the configuration properties for a pipeline
|
||||
type PipelineSettings struct {
|
||||
slug string
|
||||
branches []string
|
||||
}
|
||||
|
||||
// Settings defines the configuration properties for this module
|
||||
type Settings struct {
|
||||
*cfg.Common
|
||||
|
||||
apiKey string `help:"Your Buildkite API Token"`
|
||||
orgSlug string `help:"Organization Slug"`
|
||||
pipelines []PipelineSettings `help:"An array of pipelines to get data from"`
|
||||
}
|
||||
|
||||
// NewSettingsFromYAML creates a new settings instance from a YAML config block
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||
settings := Settings{
|
||||
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||
|
||||
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_BUILDKITE_TOKEN")),
|
||||
orgSlug: ymlConfig.UString("organizationSlug"),
|
||||
pipelines: buildPipelineSettings(ymlConfig),
|
||||
}
|
||||
|
||||
cfg.ModuleSecret(name, globalConfig, &settings.apiKey).Load()
|
||||
|
||||
return &settings
|
||||
}
|
||||
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
|
||||
func buildPipelineSettings(ymlConfig *config.Config) []PipelineSettings {
|
||||
pipelines := []PipelineSettings{}
|
||||
|
||||
for slug := range ymlConfig.UMap("pipelines") {
|
||||
branches := utils.ToStrs(ymlConfig.UList("pipelines." + slug + ".branches"))
|
||||
if len(branches) == 0 {
|
||||
branches = []string{"master"}
|
||||
}
|
||||
|
||||
pipeline := PipelineSettings{
|
||||
slug: slug,
|
||||
branches: branches,
|
||||
}
|
||||
|
||||
pipelines = append(pipelines, pipeline)
|
||||
}
|
||||
|
||||
return pipelines
|
||||
}
|
63
modules/buildkite/widget.go
Normal file
63
modules/buildkite/widget.go
Normal file
@ -0,0 +1,63 @@
|
||||
package buildkite
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/rivo/tview"
|
||||
"github.com/wtfutil/wtf/view"
|
||||
)
|
||||
|
||||
type Widget struct {
|
||||
view.TextWidget
|
||||
settings *Settings
|
||||
|
||||
builds []Build
|
||||
err error
|
||||
}
|
||||
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(tviewApp, pages, settings.Common),
|
||||
settings: settings,
|
||||
}
|
||||
|
||||
widget.initializeKeyboardControls()
|
||||
widget.View.SetScrollable(true)
|
||||
|
||||
return &widget
|
||||
}
|
||||
|
||||
/* -------------------- Exported Functions -------------------- */
|
||||
|
||||
func (widget *Widget) Refresh() {
|
||||
builds, err := widget.getBuilds()
|
||||
|
||||
if err != nil {
|
||||
widget.err = err
|
||||
widget.builds = nil
|
||||
} else {
|
||||
widget.builds = builds
|
||||
widget.err = nil
|
||||
}
|
||||
|
||||
// The last call should always be to the display function
|
||||
widget.display()
|
||||
}
|
||||
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
|
||||
func (widget *Widget) display() {
|
||||
widget.Redraw(widget.content)
|
||||
}
|
||||
|
||||
func (widget *Widget) content() (string, string, bool) {
|
||||
title := fmt.Sprintf("%s - [green]%s", widget.CommonSettings().Title, widget.settings.orgSlug)
|
||||
|
||||
if widget.err != nil {
|
||||
return title, widget.err.Error(), true
|
||||
}
|
||||
|
||||
displayData := NewPipelinesDisplayData(widget.builds)
|
||||
|
||||
return title, displayData.Content(), false
|
||||
}
|
92
modules/cds/favorites/display.go
Normal file
92
modules/cds/favorites/display.go
Normal file
@ -0,0 +1,92 @@
|
||||
package cdsfavorites
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ovh/cds/sdk"
|
||||
)
|
||||
|
||||
func (widget *Widget) display() {
|
||||
widget.TextWidget.Redraw(widget.content)
|
||||
}
|
||||
|
||||
func (widget *Widget) content() (string, string, bool) {
|
||||
if len(widget.View.GetHighlights()) > 0 {
|
||||
widget.View.ScrollToHighlight()
|
||||
} else {
|
||||
widget.View.ScrollToBeginning()
|
||||
}
|
||||
|
||||
widget.Items = make([]int64, 0)
|
||||
|
||||
workflow := widget.currentCDSWorkflow()
|
||||
if workflow == nil {
|
||||
return "", " Workflow not selected ", false
|
||||
}
|
||||
|
||||
_, _, width, _ := widget.View.GetRect()
|
||||
str := widget.settings.PaginationMarker(len(widget.workflows), widget.Idx, width) + "\n"
|
||||
title := fmt.Sprintf("%s - %s", widget.CommonSettings().Title, widget.title(workflow))
|
||||
|
||||
str += widget.displayWorkflowRuns(workflow)
|
||||
|
||||
return title, str, false
|
||||
}
|
||||
|
||||
func (widget *Widget) title(workflow *sdk.Workflow) string {
|
||||
return fmt.Sprintf(
|
||||
"[%s]%s/%s[white]",
|
||||
widget.settings.Colors.TextTheme.Title,
|
||||
workflow.ProjectKey, workflow.Name,
|
||||
)
|
||||
}
|
||||
|
||||
func (widget *Widget) displayWorkflowRuns(workflow *sdk.Workflow) string {
|
||||
runs, _ := widget.client.WorkflowRunList(workflow.ProjectKey, workflow.Name, 0, 16)
|
||||
|
||||
widget.SetItemCount(len(runs))
|
||||
|
||||
if len(runs) == 0 {
|
||||
return " [grey]none[white]\n"
|
||||
}
|
||||
|
||||
content := ""
|
||||
for idx, run := range runs {
|
||||
var tags string
|
||||
for _, tag := range run.Tags {
|
||||
toadd := true
|
||||
for _, v := range widget.settings.hideTags {
|
||||
if v == tag.Tag {
|
||||
toadd = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if toadd {
|
||||
tags = fmt.Sprintf("%s%s:%s ", tags, tag.Tag, tag.Value)
|
||||
}
|
||||
}
|
||||
content += fmt.Sprintf(`[%s]["%d"]%d %-6s[""][gray] %s`, getStatusColor(run.Status), idx, run.Number, run.Status, tags)
|
||||
content += "\n"
|
||||
widget.Items = append(widget.Items, run.Number)
|
||||
}
|
||||
|
||||
return content
|
||||
}
|
||||
|
||||
func getStatusColor(status string) string {
|
||||
switch status {
|
||||
case sdk.StatusSuccess:
|
||||
return "green"
|
||||
case sdk.StatusBuilding, sdk.StatusWaiting:
|
||||
return "blue"
|
||||
case sdk.StatusFail:
|
||||
return "red"
|
||||
case sdk.StatusStopped:
|
||||
return "red"
|
||||
case sdk.StatusSkipped:
|
||||
return "grey"
|
||||
case sdk.StatusDisabled:
|
||||
return "grey"
|
||||
}
|
||||
return "red"
|
||||
}
|
23
modules/cds/favorites/keyboard.go
Normal file
23
modules/cds/favorites/keyboard.go
Normal file
@ -0,0 +1,23 @@
|
||||
package cdsfavorites
|
||||
|
||||
import (
|
||||
"github.com/gdamore/tcell"
|
||||
)
|
||||
|
||||
func (widget *Widget) initializeKeyboardControls() {
|
||||
widget.InitializeHelpTextKeyboardControl(widget.ShowHelp)
|
||||
widget.InitializeRefreshKeyboardControl(widget.Refresh)
|
||||
|
||||
widget.SetKeyboardChar("j", widget.Next, "Select next workflow")
|
||||
widget.SetKeyboardChar("k", widget.Prev, "Select previous workflow")
|
||||
widget.SetKeyboardChar("l", widget.NextSource, "Select next source")
|
||||
widget.SetKeyboardChar("h", widget.PrevSource, "Select previous source")
|
||||
widget.SetKeyboardChar("o", widget.openWorkflow, "Open workflow in browser")
|
||||
|
||||
widget.SetKeyboardKey(tcell.KeyDown, widget.Next, "Select next workflow")
|
||||
widget.SetKeyboardKey(tcell.KeyUp, widget.Prev, "Select previous workflow")
|
||||
widget.SetKeyboardKey(tcell.KeyRight, widget.NextSource, "Select next source")
|
||||
widget.SetKeyboardKey(tcell.KeyLeft, widget.PrevSource, "Select previous source")
|
||||
widget.SetKeyboardKey(tcell.KeyEnter, widget.openWorkflow, "Open workflow in browser")
|
||||
widget.SetKeyboardKey(tcell.KeyEsc, widget.Unselect, "Clear selection")
|
||||
}
|
39
modules/cds/favorites/settings.go
Normal file
39
modules/cds/favorites/settings.go
Normal file
@ -0,0 +1,39 @@
|
||||
package cdsfavorites
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/olebedev/config"
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
"github.com/wtfutil/wtf/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
defaultFocusable = true
|
||||
defaultTitle = "CDS Favorites"
|
||||
)
|
||||
|
||||
// Settings defines the configuration properties for this module
|
||||
type Settings struct {
|
||||
*cfg.Common
|
||||
|
||||
token string `help:"Your CDS API token."`
|
||||
apiURL string `help:"Your CDS API URL."`
|
||||
uiURL string
|
||||
hideTags []string `help:"Hide some workflow tags."`
|
||||
}
|
||||
|
||||
// NewSettingsFromYAML creates a new settings instance from a YAML config block
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||
settings := Settings{
|
||||
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||
|
||||
token: ymlConfig.UString("token", ymlConfig.UString("token", os.Getenv("CDS_TOKEN"))),
|
||||
apiURL: ymlConfig.UString("apiURL", os.Getenv("CDS_API_URL")),
|
||||
hideTags: utils.ToStrs(ymlConfig.UList("hideTags")),
|
||||
}
|
||||
|
||||
settings.SetDocumentationPath("cds/favorites")
|
||||
|
||||
return &settings
|
||||
}
|
143
modules/cds/favorites/widget.go
Normal file
143
modules/cds/favorites/widget.go
Normal file
@ -0,0 +1,143 @@
|
||||
package cdsfavorites
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
||||
"github.com/ovh/cds/sdk"
|
||||
"github.com/ovh/cds/sdk/cdsclient"
|
||||
"github.com/rivo/tview"
|
||||
"github.com/wtfutil/wtf/utils"
|
||||
"github.com/wtfutil/wtf/view"
|
||||
)
|
||||
|
||||
// Widget define wtf widget to register widget later
|
||||
type Widget struct {
|
||||
view.MultiSourceWidget
|
||||
view.TextWidget
|
||||
|
||||
workflows []sdk.Workflow
|
||||
|
||||
client cdsclient.Interface
|
||||
|
||||
settings *Settings
|
||||
Selected int
|
||||
maxItems int
|
||||
Items []int64
|
||||
}
|
||||
|
||||
// NewWidget creates a new instance of the widget
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
MultiSourceWidget: view.NewMultiSourceWidget(settings.Common, "workflow", "workflows"),
|
||||
TextWidget: view.NewTextWidget(tviewApp, pages, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
||||
widget.initializeKeyboardControls()
|
||||
widget.View.SetRegions(true)
|
||||
widget.SetDisplayFunction(widget.display)
|
||||
|
||||
widget.Unselect()
|
||||
|
||||
widget.client = cdsclient.New(cdsclient.Config{
|
||||
Host: settings.apiURL,
|
||||
BuitinConsumerAuthenticationToken: settings.token,
|
||||
})
|
||||
|
||||
config, _ := widget.client.ConfigUser()
|
||||
|
||||
if config.URLUI != "" {
|
||||
widget.settings.uiURL = config.URLUI
|
||||
}
|
||||
|
||||
widget.workflows = widget.buildWorkflowsCollection()
|
||||
return &widget
|
||||
}
|
||||
|
||||
/* -------------------- Exported Functions -------------------- */
|
||||
|
||||
// SetItemCount sets the amount of workflows throughout the widgets display creation
|
||||
func (widget *Widget) SetItemCount(items int) {
|
||||
widget.maxItems = items
|
||||
}
|
||||
|
||||
// GetItemCount returns the amount of workflows calculated so far as an int
|
||||
func (widget *Widget) GetItemCount() int {
|
||||
return widget.maxItems
|
||||
}
|
||||
|
||||
// GetSelected returns the index of the currently highlighted item as an int
|
||||
func (widget *Widget) GetSelected() int {
|
||||
if widget.Selected < 0 {
|
||||
return 0
|
||||
}
|
||||
return widget.Selected
|
||||
}
|
||||
|
||||
// Next cycles the currently highlighted text down
|
||||
func (widget *Widget) Next() {
|
||||
widget.Selected++
|
||||
if widget.Selected >= widget.maxItems {
|
||||
widget.Selected = 0
|
||||
}
|
||||
widget.View.Highlight(strconv.Itoa(widget.Selected)).ScrollToHighlight()
|
||||
}
|
||||
|
||||
// Prev cycles the currently highlighted text up
|
||||
func (widget *Widget) Prev() {
|
||||
widget.Selected--
|
||||
if widget.Selected < 0 {
|
||||
widget.Selected = widget.maxItems - 1
|
||||
}
|
||||
widget.View.Highlight(strconv.Itoa(widget.Selected)).ScrollToHighlight()
|
||||
}
|
||||
|
||||
// Unselect stops highlighting the text and jumps the scroll position to the top
|
||||
func (widget *Widget) Unselect() {
|
||||
widget.Selected = -1
|
||||
widget.View.Highlight()
|
||||
widget.View.ScrollToBeginning()
|
||||
}
|
||||
|
||||
// Refresh reloads the data
|
||||
func (widget *Widget) Refresh() {
|
||||
widget.display()
|
||||
}
|
||||
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
|
||||
func (widget *Widget) buildWorkflowsCollection() []sdk.Workflow {
|
||||
workflows := []sdk.Workflow{}
|
||||
data, _ := widget.client.Navbar()
|
||||
for _, v := range data {
|
||||
if v.Favorite && v.WorkflowName != "" {
|
||||
workflows = append(workflows, sdk.Workflow{ProjectKey: v.Key, Name: v.WorkflowName})
|
||||
}
|
||||
}
|
||||
return workflows
|
||||
}
|
||||
|
||||
func (widget *Widget) currentCDSWorkflow() *sdk.Workflow {
|
||||
if len(widget.workflows) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
if widget.Idx < 0 || widget.Idx >= len(widget.workflows) {
|
||||
widget.Idx = 0
|
||||
}
|
||||
|
||||
p := widget.workflows[widget.Idx]
|
||||
return &p
|
||||
}
|
||||
|
||||
func (widget *Widget) openWorkflow() {
|
||||
currentSelection := widget.View.GetHighlights()
|
||||
if widget.Selected >= 0 && currentSelection[0] != "" {
|
||||
wf := widget.currentCDSWorkflow()
|
||||
url := fmt.Sprintf("%s/project/%s/workflow/%s/run/%d",
|
||||
widget.settings.uiURL, wf.ProjectKey, wf.Name, widget.Items[widget.Selected])
|
||||
utils.OpenFile(url)
|
||||
}
|
||||
}
|
113
modules/cds/queue/display.go
Normal file
113
modules/cds/queue/display.go
Normal file
@ -0,0 +1,113 @@
|
||||
package cdsqueue
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/ovh/cds/sdk"
|
||||
)
|
||||
|
||||
func (widget *Widget) display() {
|
||||
widget.TextWidget.Redraw(widget.content)
|
||||
}
|
||||
|
||||
func (widget *Widget) content() (string, string, bool) {
|
||||
if len(widget.View.GetHighlights()) > 0 {
|
||||
widget.View.ScrollToHighlight()
|
||||
} else {
|
||||
widget.View.ScrollToBeginning()
|
||||
}
|
||||
|
||||
widget.Items = make([]sdk.WorkflowNodeJobRun, 0)
|
||||
filter := widget.currentFilter()
|
||||
_, _, width, _ := widget.View.GetRect()
|
||||
|
||||
str := widget.settings.PaginationMarker(len(widget.filters), widget.Idx, width) + "\n"
|
||||
str += widget.displayQueue(filter)
|
||||
|
||||
title := fmt.Sprintf("%s - %s", widget.CommonSettings().Title, widget.title(filter))
|
||||
|
||||
return title, str, false
|
||||
}
|
||||
|
||||
func (widget *Widget) title(filter string) string {
|
||||
return fmt.Sprintf(
|
||||
"[%s]%d - %s[white]",
|
||||
widget.settings.Colors.TextTheme.Title,
|
||||
widget.maxItems,
|
||||
filter,
|
||||
)
|
||||
}
|
||||
|
||||
func (widget *Widget) displayQueue(filter string) string {
|
||||
runs, _ := widget.client.QueueWorkflowNodeJobRun(filter)
|
||||
|
||||
widget.SetItemCount(len(runs))
|
||||
|
||||
if len(runs) == 0 {
|
||||
return " [grey]none[white]\n"
|
||||
}
|
||||
|
||||
var content string
|
||||
for idx, job := range runs {
|
||||
content += fmt.Sprintf(`[grey]["%d"]%s`,
|
||||
idx, widget.generateQueueJobLine(job.ID, job.Parameters, job.Job, time.Since(job.Queued), job.BookedBy, job.Status))
|
||||
|
||||
widget.Items = append(widget.Items, job)
|
||||
}
|
||||
|
||||
return content
|
||||
}
|
||||
|
||||
func (widget *Widget) generateQueueJobLine(id int64, parameters []sdk.Parameter, executedJob sdk.ExecutedJob,
|
||||
duration time.Duration, bookedBy sdk.Service, status string) string {
|
||||
prj := getVarsInPbj("cds.project", parameters)
|
||||
workflow := getVarsInPbj("cds.workflow", parameters)
|
||||
node := getVarsInPbj("cds.node", parameters)
|
||||
run := getVarsInPbj("cds.run", parameters)
|
||||
triggeredBy := getVarsInPbj("cds.triggered_by.username", parameters)
|
||||
|
||||
row := make([]string, 6)
|
||||
row[0] = pad(sdk.Round(duration, time.Second).String(), 9)
|
||||
row[2] = pad(run, 7)
|
||||
row[3] = pad(prj+"/"+workflow+"/"+node, 40)
|
||||
|
||||
switch {
|
||||
case status == sdk.StatusBuilding:
|
||||
row[1] = pad(fmt.Sprintf(" %s.%s ", executedJob.WorkerName, executedJob.WorkerID), 27)
|
||||
case bookedBy.ID != 0:
|
||||
row[1] = pad(fmt.Sprintf(" %s.%d ", bookedBy.Name, bookedBy.ID), 27)
|
||||
default:
|
||||
row[1] = pad("", 27)
|
||||
}
|
||||
|
||||
row[4] = fmt.Sprintf("➤ %s", pad(triggeredBy, 17))
|
||||
|
||||
c := "grey"
|
||||
if status == sdk.StatusWaiting {
|
||||
if duration > 120*time.Second {
|
||||
c = "red"
|
||||
} else if duration > 50*time.Second {
|
||||
c = "yellow"
|
||||
}
|
||||
}
|
||||
|
||||
return fmt.Sprintf("[%s]%s [grey]%s %s %s %s\n", c, row[0], row[1], row[2], row[3], row[4])
|
||||
}
|
||||
|
||||
func pad(t string, size int) string {
|
||||
if len(t) > size {
|
||||
return t[0:size-3] + "..."
|
||||
}
|
||||
return t + strings.Repeat(" ", size-len(t))
|
||||
}
|
||||
|
||||
func getVarsInPbj(key string, ps []sdk.Parameter) string {
|
||||
for _, p := range ps {
|
||||
if p.Name == key {
|
||||
return p.Value
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
23
modules/cds/queue/keyboard.go
Normal file
23
modules/cds/queue/keyboard.go
Normal file
@ -0,0 +1,23 @@
|
||||
package cdsqueue
|
||||
|
||||
import (
|
||||
"github.com/gdamore/tcell"
|
||||
)
|
||||
|
||||
func (widget *Widget) initializeKeyboardControls() {
|
||||
widget.InitializeHelpTextKeyboardControl(widget.ShowHelp)
|
||||
widget.InitializeRefreshKeyboardControl(widget.Refresh)
|
||||
|
||||
widget.SetKeyboardChar("j", widget.Next, "Select next workflow")
|
||||
widget.SetKeyboardChar("k", widget.Prev, "Select previous workflow")
|
||||
widget.SetKeyboardChar("l", widget.NextSource, "Select next filter")
|
||||
widget.SetKeyboardChar("h", widget.PrevSource, "Select previous filter")
|
||||
widget.SetKeyboardChar("o", widget.openWorkflow, "Open workflow in browser")
|
||||
|
||||
widget.SetKeyboardKey(tcell.KeyDown, widget.Next, "Select next workflow")
|
||||
widget.SetKeyboardKey(tcell.KeyUp, widget.Prev, "Select previous workflow")
|
||||
widget.SetKeyboardKey(tcell.KeyRight, widget.NextSource, "Select next filter")
|
||||
widget.SetKeyboardKey(tcell.KeyLeft, widget.PrevSource, "Select previous filter")
|
||||
widget.SetKeyboardKey(tcell.KeyEnter, widget.openWorkflow, "Open workflow in browser")
|
||||
widget.SetKeyboardKey(tcell.KeyEsc, widget.Unselect, "Clear selection")
|
||||
}
|
36
modules/cds/queue/settings.go
Normal file
36
modules/cds/queue/settings.go
Normal file
@ -0,0 +1,36 @@
|
||||
package cdsqueue
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/olebedev/config"
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const (
|
||||
defaultFocusable = true
|
||||
defaultTitle = "CDS Queue"
|
||||
)
|
||||
|
||||
// Settings defines the configuration properties for this module
|
||||
type Settings struct {
|
||||
*cfg.Common
|
||||
|
||||
token string `help:"Your CDS API token."`
|
||||
apiURL string `help:"Your CDS API URL."`
|
||||
uiURL string
|
||||
}
|
||||
|
||||
// NewSettingsFromYAML creates a new settings instance from a YAML config block
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||
settings := Settings{
|
||||
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||
|
||||
token: ymlConfig.UString("token", ymlConfig.UString("token", os.Getenv("CDS_TOKEN"))),
|
||||
apiURL: ymlConfig.UString("apiURL", os.Getenv("CDS_API_URL")),
|
||||
}
|
||||
|
||||
settings.SetDocumentationPath("cds/queue")
|
||||
|
||||
return &settings
|
||||
}
|
134
modules/cds/queue/widget.go
Normal file
134
modules/cds/queue/widget.go
Normal file
@ -0,0 +1,134 @@
|
||||
package cdsqueue
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
||||
"github.com/ovh/cds/sdk"
|
||||
"github.com/ovh/cds/sdk/cdsclient"
|
||||
"github.com/rivo/tview"
|
||||
"github.com/wtfutil/wtf/utils"
|
||||
"github.com/wtfutil/wtf/view"
|
||||
)
|
||||
|
||||
// Widget define wtf widget to register widget later
|
||||
type Widget struct {
|
||||
view.MultiSourceWidget
|
||||
view.TextWidget
|
||||
|
||||
filters []string
|
||||
|
||||
client cdsclient.Interface
|
||||
|
||||
settings *Settings
|
||||
Selected int
|
||||
maxItems int
|
||||
Items []sdk.WorkflowNodeJobRun
|
||||
}
|
||||
|
||||
// NewWidget creates a new instance of the widget
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
MultiSourceWidget: view.NewMultiSourceWidget(settings.Common, "workflow", "workflows"),
|
||||
TextWidget: view.NewTextWidget(tviewApp, pages, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
||||
widget.initializeKeyboardControls()
|
||||
widget.View.SetRegions(true)
|
||||
widget.SetDisplayFunction(widget.display)
|
||||
|
||||
widget.Unselect()
|
||||
widget.filters = []string{sdk.StatusWaiting, sdk.StatusBuilding}
|
||||
|
||||
widget.client = cdsclient.New(cdsclient.Config{
|
||||
Host: settings.apiURL,
|
||||
BuitinConsumerAuthenticationToken: settings.token,
|
||||
})
|
||||
|
||||
config, _ := widget.client.ConfigUser()
|
||||
|
||||
if config.URLUI != "" {
|
||||
widget.settings.uiURL = config.URLUI
|
||||
}
|
||||
|
||||
return &widget
|
||||
}
|
||||
|
||||
/* -------------------- Exported Functions -------------------- */
|
||||
|
||||
// SetItemCount sets the amount of workflows throughout the widgets display creation
|
||||
func (widget *Widget) SetItemCount(items int) {
|
||||
widget.maxItems = items
|
||||
}
|
||||
|
||||
// GetItemCount returns the amount of workflows calculated so far as an int
|
||||
func (widget *Widget) GetItemCount() int {
|
||||
return widget.maxItems
|
||||
}
|
||||
|
||||
// GetSelected returns the index of the currently highlighted item as an int
|
||||
func (widget *Widget) GetSelected() int {
|
||||
if widget.Selected < 0 {
|
||||
return 0
|
||||
}
|
||||
return widget.Selected
|
||||
}
|
||||
|
||||
// Next cycles the currently highlighted text down
|
||||
func (widget *Widget) Next() {
|
||||
widget.Selected++
|
||||
if widget.Selected >= widget.maxItems {
|
||||
widget.Selected = 0
|
||||
}
|
||||
widget.View.Highlight(strconv.Itoa(widget.Selected)).ScrollToHighlight()
|
||||
}
|
||||
|
||||
// Prev cycles the currently highlighted text up
|
||||
func (widget *Widget) Prev() {
|
||||
widget.Selected--
|
||||
if widget.Selected < 0 {
|
||||
widget.Selected = widget.maxItems - 1
|
||||
}
|
||||
widget.View.Highlight(strconv.Itoa(widget.Selected)).ScrollToHighlight()
|
||||
}
|
||||
|
||||
// Unselect stops highlighting the text and jumps the scroll position to the top
|
||||
func (widget *Widget) Unselect() {
|
||||
widget.Selected = -1
|
||||
widget.View.Highlight()
|
||||
widget.View.ScrollToBeginning()
|
||||
}
|
||||
|
||||
// Refresh reloads the data
|
||||
func (widget *Widget) Refresh() {
|
||||
widget.display()
|
||||
}
|
||||
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
|
||||
func (widget *Widget) currentFilter() string {
|
||||
if len(widget.filters) == 0 {
|
||||
return sdk.StatusWaiting
|
||||
}
|
||||
|
||||
if widget.Idx < 0 || widget.Idx >= len(widget.filters) {
|
||||
widget.Idx = 0
|
||||
return sdk.StatusWaiting
|
||||
}
|
||||
|
||||
return widget.filters[widget.Idx]
|
||||
}
|
||||
|
||||
func (widget *Widget) openWorkflow() {
|
||||
currentSelection := widget.View.GetHighlights()
|
||||
if widget.Selected >= 0 && currentSelection[0] != "" {
|
||||
job := widget.Items[widget.Selected]
|
||||
prj := getVarsInPbj("cds.project", job.Parameters)
|
||||
workflow := getVarsInPbj("cds.workflow", job.Parameters)
|
||||
runNumber := getVarsInPbj("cds.run.number", job.Parameters)
|
||||
url := fmt.Sprintf("%s/project/%s/workflow/%s/run/%s", widget.settings.uiURL, prj, workflow, runNumber)
|
||||
utils.OpenFile(url)
|
||||
}
|
||||
}
|
88
modules/cds/status/display.go
Normal file
88
modules/cds/status/display.go
Normal file
@ -0,0 +1,88 @@
|
||||
package cdsstatus
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/ovh/cds/sdk"
|
||||
)
|
||||
|
||||
func (widget *Widget) display() {
|
||||
widget.TextWidget.Redraw(widget.content)
|
||||
}
|
||||
|
||||
func (widget *Widget) content() (string, string, bool) {
|
||||
if len(widget.View.GetHighlights()) > 0 {
|
||||
widget.View.ScrollToHighlight()
|
||||
} else {
|
||||
widget.View.ScrollToBeginning()
|
||||
}
|
||||
|
||||
widget.Items = make([]sdk.MonitoringStatusLine, 0)
|
||||
str := widget.displayStatus()
|
||||
title := widget.CommonSettings().Title
|
||||
return title, str, false
|
||||
}
|
||||
|
||||
func (widget *Widget) displayStatus() string {
|
||||
status, err := widget.client.MonStatus()
|
||||
|
||||
if err != nil || len(status.Lines) == 0 {
|
||||
return fmt.Sprintf(" [red]Error: %v[white]\n", err.Error())
|
||||
}
|
||||
|
||||
widget.SetItemCount(len(status.Lines))
|
||||
|
||||
var (
|
||||
global []string
|
||||
globalWarn []string
|
||||
globalRed []string
|
||||
ok []string
|
||||
warn []string
|
||||
red []string
|
||||
)
|
||||
|
||||
for _, line := range status.Lines {
|
||||
switch {
|
||||
case line.Status == sdk.MonitoringStatusWarn && strings.Contains(line.Component, "Global"):
|
||||
globalWarn = append(globalWarn, line.String())
|
||||
case line.Status != sdk.MonitoringStatusOK && strings.Contains(line.Component, "Global"):
|
||||
globalRed = append(globalRed, line.String())
|
||||
case strings.Contains(line.Component, "Global"):
|
||||
global = append(global, line.String())
|
||||
case line.Status == sdk.MonitoringStatusWarn:
|
||||
warn = append(warn, line.String())
|
||||
case line.Status == sdk.MonitoringStatusOK:
|
||||
ok = append(ok, line.String())
|
||||
default:
|
||||
red = append(red, line.String())
|
||||
}
|
||||
}
|
||||
var idx int
|
||||
var content string
|
||||
for _, v := range globalRed {
|
||||
content += fmt.Sprintf("[grey][\"%d\"][red]%s\n", idx, v)
|
||||
idx++
|
||||
}
|
||||
for _, v := range globalWarn {
|
||||
content += fmt.Sprintf("[grey][\"%d\"][yellow]%s\n", idx, v)
|
||||
idx++
|
||||
}
|
||||
for _, v := range global {
|
||||
content += fmt.Sprintf("[grey][\"%d\"][grey]%s\n", idx, v)
|
||||
idx++
|
||||
}
|
||||
for _, v := range red {
|
||||
content += fmt.Sprintf("[grey][\"%d\"][red]%s\n", idx, v)
|
||||
idx++
|
||||
}
|
||||
for _, v := range warn {
|
||||
content += fmt.Sprintf("[grey][\"%d\"][yellow]%s\n", idx, v)
|
||||
idx++
|
||||
}
|
||||
for _, v := range ok {
|
||||
content += fmt.Sprintf("[grey][\"%d\"][grey]%s\n", idx, v)
|
||||
idx++
|
||||
}
|
||||
return content
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user