mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Compare commits
No commits in common. "master" and "v0.9.2" have entirely different histories.
@ -476,612 +476,9 @@
|
||||
"name": "Graham Anderson",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/38514?v=4",
|
||||
"profile": "https://github.com/gnanderson",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "bosr",
|
||||
"name": "Romain Bossart",
|
||||
"avatar_url": "https://avatars2.githubusercontent.com/u/1936828?v=4",
|
||||
"profile": "https://github.com/bosr",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "sosiska",
|
||||
"name": "Kirill Motkov",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/969838?v=4",
|
||||
"profile": "http://eonix.ru",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "Choromanski",
|
||||
"name": "Brian Choromanski",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/3665694?v=4",
|
||||
"profile": "http://www.BrianChoromanski.com",
|
||||
"contributions": []
|
||||
},
|
||||
{
|
||||
"login": "Sean-Der",
|
||||
"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,
|
||||
"commitConvention": "none"
|
||||
"contributorsPerLine": 7
|
||||
}
|
||||
|
1
.github/FUNDING.yml
vendored
1
.github/FUNDING.yml
vendored
@ -1 +0,0 @@
|
||||
github: senorprogrammer
|
16
.github/ISSUE_TEMPLATE/Bug.md
vendored
16
.github/ISSUE_TEMPLATE/Bug.md
vendored
@ -1,6 +1,16 @@
|
||||
---
|
||||
name: 🐞 Report a Bug
|
||||
about: Tell us what's broken
|
||||
name: Bug Report
|
||||
about: Something is broken?
|
||||
---
|
||||
|
||||
## What's broken?
|
||||
#### What's the problem?
|
||||
|
||||
|
||||
#### How did you expect it to behave?
|
||||
|
||||
|
||||
#### Operating system
|
||||
|
||||
#### Terminal program & version
|
||||
|
||||
#### WTF version
|
||||
|
11
.github/ISSUE_TEMPLATE/Feature.md
vendored
11
.github/ISSUE_TEMPLATE/Feature.md
vendored
@ -1,6 +1,11 @@
|
||||
---
|
||||
name: ⚡️ Request a Feature
|
||||
about: Tell us what it should do
|
||||
name: Feature Request
|
||||
about: You have a neat idea that should be implemented?
|
||||
---
|
||||
|
||||
## What should it do?
|
||||
#### What problem does this solve?
|
||||
|
||||
|
||||
#### How do envision it working?
|
||||
|
||||
|
||||
|
6
.github/ISSUE_TEMPLATE/Support.md
vendored
6
.github/ISSUE_TEMPLATE/Support.md
vendored
@ -1,8 +1,8 @@
|
||||
---
|
||||
name: ❓Ask a Question
|
||||
about: Tell us how we can help
|
||||
name: ❓ Support Question
|
||||
about: Have a problem that you can't figure out?
|
||||
---
|
||||
|
||||
## How can we help?
|
||||
#### What problem are you having and how can we help?
|
||||
|
||||
|
||||
|
5
.github/PULL_REQUEST_TEMPLATE/Improvement.md
vendored
5
.github/PULL_REQUEST_TEMPLATE/Improvement.md
vendored
@ -3,6 +3,9 @@ name: Improvement
|
||||
about: You have some improvement to make wtf better?
|
||||
---
|
||||
|
||||
Thanks for submitting a pull request. Please provide enough information so that others can review your pull request.
|
||||
#### What problem does this solve?
|
||||
|
||||
|
||||
#### Is this related to an existing Issue? If so, which one?
|
||||
|
||||
|
||||
|
4
.github/PULL_REQUEST_TEMPLATE/Other.md
vendored
4
.github/PULL_REQUEST_TEMPLATE/Other.md
vendored
@ -3,7 +3,9 @@ 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.
|
||||
<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. -->
|
||||
|
||||
#### What problem does this solve?
|
||||
|
||||
|
||||
|
||||
|
11
.github/dependabot.yml
vendored
11
.github/dependabot.yml
vendored
@ -1,11 +0,0 @@
|
||||
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
51
.github/workflows/codeql-analysis.yml
vendored
@ -1,51 +0,0 @@
|
||||
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
22
.github/workflows/golangci-lint.yml
vendored
@ -1,22 +0,0 @@
|
||||
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
30
.github/workflows/goreleaser.yml
vendored
@ -1,30 +0,0 @@
|
||||
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
70
.github/workflows/staticcheck.yml
vendored
@ -1,70 +0,0 @@
|
||||
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"
|
@ -1,18 +0,0 @@
|
||||
run:
|
||||
timeout: 2m
|
||||
|
||||
linters:
|
||||
enable:
|
||||
- vet
|
||||
- errcheck
|
||||
- staticcheck
|
||||
# - dupl
|
||||
# - funlen
|
||||
# - goconst
|
||||
# - gocritic
|
||||
- gofmt
|
||||
# - golint
|
||||
# - misspell
|
||||
# - stylecheck
|
||||
- unconvert
|
||||
# - whitespace
|
@ -1,30 +1,19 @@
|
||||
env:
|
||||
- GO111MODULE=on
|
||||
- GOPROXY="https://proxy.golang.org,direct"
|
||||
|
||||
archives:
|
||||
- id: default
|
||||
wrap_in_directory: true
|
||||
|
||||
builds:
|
||||
- binary: wtfutil
|
||||
goos:
|
||||
- darwin
|
||||
- linux
|
||||
goarch:
|
||||
- amd64
|
||||
- arm
|
||||
- arm64
|
||||
|
||||
before:
|
||||
hooks:
|
||||
- make install
|
||||
|
||||
brews:
|
||||
-
|
||||
name: wtfutil
|
||||
homepage: 'https://wtfutil.com'
|
||||
description: 'The personal information dashboard for your terminal.'
|
||||
tap:
|
||||
owner: wtfutil
|
||||
name: homebrew-wtfutil
|
||||
builds:
|
||||
- binary: wtf
|
||||
goos:
|
||||
- darwin
|
||||
- linux
|
||||
goarch:
|
||||
- 386
|
||||
- amd64
|
||||
|
||||
env:
|
||||
- GO111MODULE=on
|
||||
- GOPROXY="https://gocenter.io"
|
||||
|
||||
archive:
|
||||
wrap_in_directory: true
|
||||
|
10
.travis.yml
10
.travis.yml
@ -1,14 +1,14 @@
|
||||
language: go
|
||||
|
||||
go:
|
||||
- "1.16.x"
|
||||
|
||||
- "1.11.x"
|
||||
- "1.12.x"
|
||||
sudo: false
|
||||
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://proxy.golang.org,direct"
|
||||
- export GOPROXY="https://gocenter.io" && export GO111MODULE=on
|
||||
|
||||
script: go get ./... && ./scripts/check-uncommitted-vendor-files.sh && go test -v github.com/wtfutil/wtf/...
|
||||
script: go get ./... && go get github.com/go-test/deep && go test -v github.com/wtfutil/wtf/wtf_tests/...
|
||||
|
517
CHANGELOG.md
517
CHANGELOG.md
@ -4,525 +4,8 @@
|
||||
|
||||
### ⚡️ 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
|
||||
|
||||
* Textfile module's text wrapping is configurable via the 'wrapText' boolean setting
|
||||
* Have I Been Pwned (HIBP) module added (https://wtfutil.com/modules/hibp/)
|
||||
|
||||
## v0.11.0
|
||||
|
||||
### ⚡️ Added
|
||||
|
||||
* GitHub module now supports custom queries for issues and pull requests, by [@Sean-Der](https://github.com/Sean-Der)
|
||||
|
||||
### 🐞 Fixed
|
||||
|
||||
* Todoist now properly updates list items when Refresh is called
|
||||
* Keyboard modal displays properly when tabbing between widgets, [#467](https://github.com/wtfutil/wtf/issues/467)
|
||||
|
||||
## v0.10.3
|
||||
|
||||
### ❗️Changed
|
||||
|
||||
* Invalid glog dependency removed, by [@bosr](https://github.com/bosr)
|
||||
|
||||
## v0.10.2
|
||||
|
||||
### 🐞 Fixed
|
||||
|
||||
* Weather module no longer crashes if there's no weather data or no internet connection
|
||||
* Gitlab no longer prevents installing with missing param, [#455](https://github.com/wtfutil/wtf/issues/455)
|
||||
|
||||
## v0.10.1
|
||||
|
||||
### 🐞 Fixed
|
||||
|
||||
* Trello now displays multiple lists properly, [#454](https://github.com/wtfutil/wtf/issues/454)
|
||||
|
||||
## v0.10.0
|
||||
|
||||
### ⚡️ Added
|
||||
|
||||
* DataDog module is now scrollable and interactive, by [@Seanstoppable](https://github.com/Seanstoppable)
|
||||
* Focusable hot key numbers are now assigned in a stable order, [#435](https://github.com/wtfutil/wtf/issues/435) by [@Seanstoppable](https://github.com/Seanstoppable)
|
||||
* Zendesk widget now has help text, by [@Seanstoppable](https://github.com/Seanstoppable)
|
||||
* Scrollable widget added to provide common keyboard-navigation list functionality, by [@Seanstoppable](https://github.com/Seanstoppable)
|
||||
* Logging functionality extracted out from Log module, by [@Seanstoppable](https://github.com/Seanstoppable)
|
||||
* Improved sample configs with up-to-date attributes and examples, by [@retgits](https://github.com/retgits)
|
||||
* PagerDuty config now supports schedule filtering using the `scheduleIDs` config option, by [@senporprogrammer](https://github.com/senporprogrammer)
|
||||
|
||||
## v0.9.2
|
||||
|
||||
### ⚡️ Added
|
||||
|
||||
* Keyboard management system for modules reworked. Now has a KeyboardWidget to simplify adding keyboard commands
|
||||
|
||||
### Fixed
|
||||
|
||||
* WTF versions are now prefixed with `v` again so module systems pick up the latest versions
|
||||
|
||||
## 0.9.1
|
||||
|
||||
### ⚡️ Added
|
||||
|
@ -1,13 +1,17 @@
|
||||
# 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.
|
||||
Documentation lives in the `_site` directory and is a [Hugo](https://gohugo.io) app. See Hugo's documentation for usage.
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
@ -66,7 +70,7 @@ further defined and clarified by project maintainers.
|
||||
### Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project owner at chriscummer@me.com. All
|
||||
reported by contacting the project team at [INSERT EMAIL ADDRESS]. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
|
26
Dockerfile
26
Dockerfile
@ -1,26 +0,0 @@
|
||||
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"]
|
@ -1,18 +0,0 @@
|
||||
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/
|
50
LICENSE.md
50
LICENSE.md
@ -1,8 +1,6 @@
|
||||
*Mozilla Public License, version 2.0*
|
||||
Copyright 2018, Chris Cummer
|
||||
|
||||
1. Definitions
|
||||
|
||||
1.1. “Contributor” means each individual or legal entity that creates, contributes to the creation of, or owns Covered Software.
|
||||
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.2. “Contributor Version” means the combination of the Contributions of others (if any) used by a Contributor and that particular Contributor’s Contribution.
|
||||
|
||||
@ -38,9 +36,7 @@ that the Covered Software was made available under the terms of version 1.1 or e
|
||||
|
||||
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
|
||||
|
||||
@ -66,9 +62,7 @@ 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:
|
||||
|
||||
@ -82,37 +76,23 @@ 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
|
||||
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.
|
||||
|
||||
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. 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
|
||||
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.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
7. Limitation of Liability
|
||||
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.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
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. 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.
|
||||
|
||||
@ -120,14 +100,10 @@ This License represents the complete agreement concerning the subject matter her
|
||||
|
||||
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.
|
||||
|
141
Makefile
141
Makefile
@ -1,11 +1,10 @@
|
||||
.PHONY: build clean contrib_check coverage docker-build docker-install help install isntall lint run size test uninstall
|
||||
.PHONY: contrib_check dependencies install run size test
|
||||
|
||||
# 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),)
|
||||
@ -19,146 +18,28 @@ endif
|
||||
|
||||
# Set go modules to on and use GoCenter for immutable modules
|
||||
export GO111MODULE = on
|
||||
export GOPROXY = https://proxy.golang.org,direct
|
||||
export GOPROXY = https://gocenter.io
|
||||
|
||||
# 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:
|
||||
@echo "$$HEADER"
|
||||
@echo "Building..."
|
||||
go build -o bin/${APP}
|
||||
@echo "Done building"
|
||||
go build -o bin/wtf
|
||||
|
||||
## 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:
|
||||
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)"
|
||||
@mv ~/go/bin/wtf ~/go/bin/${APP}
|
||||
$(eval INSTALLPATH = $(shell which ${APP}))
|
||||
@echo "${APP} installed into ${INSTALLPATH}"
|
||||
@which wtf || echo "Could not find wtf in PATH" && exit 0
|
||||
|
||||
## lint: runs a number of code quality checks against the source code
|
||||
lint:
|
||||
golangci-lint cache clean
|
||||
golangci-lint run
|
||||
structcheck ./...
|
||||
varcheck ./...
|
||||
|
||||
# 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
|
||||
@echo "$$HEADER"
|
||||
bin/${APP}
|
||||
bin/wtf
|
||||
|
||||
size:
|
||||
loc --exclude _sample_configs/ _site/ docs/ Makefile *.md
|
||||
|
||||
## test: runs the test suite
|
||||
test: build
|
||||
@echo "$$HEADER"
|
||||
go test ./...
|
||||
|
||||
## uninstall: uninstals a locally-installed version
|
||||
uninstall:
|
||||
@rm ~/go/bin/${APP}
|
||||
|
425
README.md
425
README.md
@ -1,106 +1,42 @@
|
||||
<p align="center">
|
||||
<img src="./images/logo_transparent.png?raw=true" title="WTF" alt="WTF" width="560" height="560" />
|
||||
</p>
|
||||
|
||||
<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>
|
||||
[](#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)
|
||||
|
||||
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.
|
||||
# WTF
|
||||
|
||||
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).
|
||||
A personal terminal-based dashboard utility, designed for
|
||||
displaying infrequently-needed, but very important, daily data.
|
||||
|
||||
### Are you a contributor or sponsor?
|
||||
### Twitter
|
||||
|
||||
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.
|
||||
Follow [on Twitter](https://twitter.com/wtfutil) for news and latest updates.
|
||||
|
||||
#
|
||||
### Slack
|
||||
|
||||
<p></p>
|
||||
If you’re a member of the Gophers Slack community (https://invite.slack.golangbridge.org) there’s now a WTFUtil channel you should join for all your WTF questions, dev conversations, etc.
|
||||
|
||||
* [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)
|
||||
Find #wtfutil on https://gophers.slack.com/ and join us.
|
||||
|
||||
## Screenshot
|
||||
|
||||
<p align="center">
|
||||
<img src="./images/screenshot.jpg" title="screenshot" width="720" height="420" />
|
||||
</p>
|
||||
|
||||
## Installation
|
||||
## Quick Start
|
||||
|
||||
### 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
|
||||
[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
|
||||
export GOPROXY="https://proxy.golang.org,direct"
|
||||
|
||||
# Disable the Go checksum database
|
||||
export GOSUMDB=off
|
||||
|
||||
# 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
|
||||
@ -110,115 +46,39 @@ 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"
|
||||
|
||||
# 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
|
||||
```
|
||||
|
||||
### 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
|
||||
|
||||
If you’re a member of the Gophers Slack community (https://invite.slack.golangbridge.org) there’s a WTFUtil channel you should join for all your WTF questions, development conversations, etc.
|
||||
|
||||
Find #wtfutil on https://gophers.slack.com/ and join us.
|
||||
|
||||
### Twitter
|
||||
|
||||
Also, follow [on Twitter](https://twitter.com/wtfutil) for news and latest updates.
|
||||
**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`.
|
||||
|
||||
## Documentation
|
||||
|
||||
See [https://wtfutil.com](https://wtfutil.com) for the definitive
|
||||
documentation. Here's some short-cuts:
|
||||
|
||||
* [Installation](https://wtfutil.com/quick_start/)
|
||||
* [Configuration](https://wtfutil.com/configuration/files/)
|
||||
* [Installation](https://wtfutil.com/getting_started/installation/)
|
||||
* [Configuration](https://wtfutil.com/configuration/)
|
||||
* [Module Documentation](https://wtfutil.com/modules/)
|
||||
|
||||
## 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
|
||||
### 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 open your issue, propose your approach, and join the rest of the awesome people who've contributed their time and effort towards WTF. Without you it wouldn't be possible.
|
||||
|
||||
### 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.
|
||||
@ -226,210 +86,18 @@ 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-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 -->
|
||||
<!-- 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 /> |
|
||||
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
||||
|
||||
## Acknowledgments
|
||||
@ -437,7 +105,8 @@ 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).
|
||||
|
||||
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).
|
||||
Many thanks to <a href="https://lendesk.com">Lendesk</a> for supporting this project by
|
||||
providing time to develop it.
|
||||
|
||||
<p align="center">
|
||||
<img src="./images/dude_wtf.png?raw=true" title="Dude WTF" width="251" height="201" />
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 196 KiB |
@ -14,8 +14,9 @@ wtf:
|
||||
graphIcon: "💀"
|
||||
graphStars: 25
|
||||
position:
|
||||
top: 1
|
||||
top: 2
|
||||
left: 0
|
||||
height: 2
|
||||
width: 2
|
||||
refreshInterval: 30
|
||||
updateInterval: 15
|
||||
|
236
_sample_configs/complex_config.yml
Normal file
236
_sample_configs/complex_config.yml
Normal file
@ -0,0 +1,236 @@
|
||||
wtf:
|
||||
colors:
|
||||
background: gray
|
||||
border:
|
||||
focusable: darkslateblue
|
||||
focused: orange
|
||||
normal: gray
|
||||
grid:
|
||||
# How _wide_ the columns are, in terminal characters. In this case we have
|
||||
# five columns, each of which are 37 characters wide
|
||||
columns: [37, 37, 37, 37, 37]
|
||||
|
||||
# How _high_ the rows are, in terminal lines. In this case we have five rows
|
||||
# that support ten line of text, and one of four
|
||||
rows: [10, 10, 10, 10, 10, 4]
|
||||
refreshInterval: 1
|
||||
mods:
|
||||
bamboohr:
|
||||
enabled: true
|
||||
position:
|
||||
top: 0
|
||||
left: 0
|
||||
height: 2
|
||||
width: 1
|
||||
refreshInterval: 900
|
||||
clocks:
|
||||
colors:
|
||||
rows:
|
||||
even: "lightblue"
|
||||
odd: "white"
|
||||
enabled: true
|
||||
locations:
|
||||
# From https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
||||
Avignon: "Europe/Paris"
|
||||
Barcelona: "Europe/Madrid"
|
||||
Dubai: "Asia/Dubai"
|
||||
UTC: "Etc/UTC"
|
||||
Vancouver: "America/Vancouver"
|
||||
Toronto: "America/Toronto"
|
||||
position:
|
||||
top: 3
|
||||
left: 1
|
||||
height: 1
|
||||
width: 1
|
||||
refreshInterval: 15
|
||||
# Valid options are: alphabetical, chronological
|
||||
sort: "alphabetical"
|
||||
cmdrunner:
|
||||
args: ["-g", "batt"]
|
||||
cmd: "pmset"
|
||||
enabled: true
|
||||
position:
|
||||
top: 6
|
||||
left: 2
|
||||
height: 1
|
||||
width: 2
|
||||
refreshInterval: 30
|
||||
gcal:
|
||||
colors:
|
||||
title: "red"
|
||||
description: "lightblue"
|
||||
highlights:
|
||||
- ['1on1|1\/11', 'green']
|
||||
- ['apple|google|aws', 'blue']
|
||||
- ['interview|meet\ ', 'lightseagreen']
|
||||
- ['lunch', 'yellow']
|
||||
past: "gray"
|
||||
conflictIcon: "🚨"
|
||||
currentIcon: "💥"
|
||||
displayResponseStatus: true
|
||||
email: "your.email@example.com"
|
||||
enabled: true
|
||||
eventCount: 12
|
||||
position:
|
||||
top: 0
|
||||
left: 0
|
||||
height: 4
|
||||
width: 1
|
||||
refreshInterval: 300
|
||||
secretFile: "~/.config/wtf/gcal/client_secret.json"
|
||||
withLocation: true
|
||||
gspreadsheets:
|
||||
colors:
|
||||
values: "green"
|
||||
cells:
|
||||
names:
|
||||
- "Cell 1 name"
|
||||
- "Cell 2 name"
|
||||
addresses:
|
||||
- "A1"
|
||||
- "A2"
|
||||
enabled: true
|
||||
position:
|
||||
top: 0
|
||||
left: 0
|
||||
width: 1
|
||||
height: 1
|
||||
refreshInterval: "300"
|
||||
secretFile: "~/.config/wtf/gspreadsheets/client_secret.json"
|
||||
sheetId: "id_of_google_spreadsheet"
|
||||
git:
|
||||
commitCount: 5
|
||||
enabled: true
|
||||
position:
|
||||
top: 0
|
||||
left: 2
|
||||
height: 2
|
||||
width: 3
|
||||
refreshInterval: 8
|
||||
repositories:
|
||||
- "/Users/chris/go/src/github.com/wtfutil/wtf"
|
||||
github:
|
||||
enabled: true
|
||||
position:
|
||||
top: 2
|
||||
left: 2
|
||||
height: 2
|
||||
width: 3
|
||||
refreshInterval: 300
|
||||
repositories:
|
||||
repo-name: "owner id"
|
||||
wtf: "wtfutil"
|
||||
username: "wtfutil"
|
||||
jira:
|
||||
colors:
|
||||
rows:
|
||||
even: "lightblue"
|
||||
odd: "white"
|
||||
domain: "https://company.atlassian.net"
|
||||
enabled: true
|
||||
position:
|
||||
top: 1
|
||||
left: 1
|
||||
height: 1
|
||||
width: 1
|
||||
project: "WTF"
|
||||
refreshInterval: 900
|
||||
username: "chris.cummer"
|
||||
newrelic:
|
||||
applicationId: 10594735
|
||||
enabled: true
|
||||
deployCount: 10
|
||||
position:
|
||||
top: 4
|
||||
left: 2
|
||||
height: 2
|
||||
width: 3
|
||||
refreshInterval: 900
|
||||
opsgenie:
|
||||
displayEmpty: true
|
||||
enabled: true
|
||||
position:
|
||||
top: 2
|
||||
left: 0
|
||||
height: 2
|
||||
width: 1
|
||||
refreshInterval: 21600
|
||||
power:
|
||||
enabled: true
|
||||
position:
|
||||
top: 5
|
||||
left: 0
|
||||
height: 2
|
||||
width: 1
|
||||
refreshInterval: 15
|
||||
security:
|
||||
enabled: true
|
||||
position:
|
||||
top: 4
|
||||
left: 0
|
||||
height: 2
|
||||
width: 1
|
||||
refreshInterval: 3600
|
||||
status:
|
||||
enabled: false
|
||||
position:
|
||||
top: 5
|
||||
left: 0
|
||||
height: 1
|
||||
width: 1
|
||||
refreshInterval: 1
|
||||
system:
|
||||
enabled: true
|
||||
position:
|
||||
top: 5
|
||||
left: 1
|
||||
height: 2
|
||||
width: 1
|
||||
refreshInterval: 3600
|
||||
todo:
|
||||
checkedIcon: "X"
|
||||
colors:
|
||||
checked: gray
|
||||
highlight:
|
||||
fore: "black"
|
||||
back: "orange"
|
||||
enabled: true
|
||||
filename: "todo.yml"
|
||||
position:
|
||||
top: 0
|
||||
left: 1
|
||||
height: 2
|
||||
width: 1
|
||||
refreshInterval: 3600
|
||||
weather:
|
||||
apiKey: [YOUR API KEY]
|
||||
# From http://openweathermap.org/help/city_list.txt
|
||||
cityids:
|
||||
- 3370352
|
||||
- 1283240
|
||||
WTF_OWM_API_KEY: [YOUR API KEY]
|
||||
colors:
|
||||
current: "lightblue"
|
||||
enabled: true
|
||||
language: "EN"
|
||||
position:
|
||||
top: 2
|
||||
left: 1
|
||||
height: 1
|
||||
width: 1
|
||||
refreshInterval: 90
|
||||
tempUnit: "C"
|
||||
blockfolio:
|
||||
enabled: true
|
||||
displayHoldings: true
|
||||
refreshInterval: 400
|
||||
device_token: "device token here, you can find how to get it here https://github.com/bob6664569/blockfolio-api-client"
|
||||
colors:
|
||||
name: blue
|
||||
grows: green
|
||||
drop: red
|
||||
position:
|
||||
top: 3
|
||||
left: 1
|
||||
width: 1
|
||||
height: 1
|
@ -1,21 +0,0 @@
|
||||
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
|
Binary file not shown.
Before Width: | Height: | Size: 278 KiB |
@ -1,21 +0,0 @@
|
||||
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
|
Binary file not shown.
Before Width: | Height: | Size: 891 KiB |
@ -1,180 +0,0 @@
|
||||
wtf:
|
||||
colors:
|
||||
background: black
|
||||
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: [35, 35, 35, 35]
|
||||
# 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: [10, 10, 10, 10, 4]
|
||||
refreshInterval: 1
|
||||
openFileUtil: "open"
|
||||
mods:
|
||||
# You can have multiple widgets of the same type.
|
||||
# The "key" is the name of the widget and the type is the actual
|
||||
# widget you want to implement.
|
||||
europe_time:
|
||||
title: "Europe"
|
||||
type: clocks
|
||||
colors:
|
||||
rows:
|
||||
even: "lightblue"
|
||||
odd: "white"
|
||||
enabled: true
|
||||
locations:
|
||||
GMT: "Etc/GMT"
|
||||
Amsterdam: "Europe/Amsterdam"
|
||||
Berlin: "Europe/Berlin"
|
||||
Barcelona: "Europe/Madrid"
|
||||
Copenhagen: "Europe/Copenhagen"
|
||||
London: "Europe/London"
|
||||
Rome: "Europe/Rome"
|
||||
Stockholm: "Europe/Stockholm"
|
||||
position:
|
||||
top: 0
|
||||
left: 0
|
||||
height: 1
|
||||
width: 1
|
||||
refreshInterval: 15
|
||||
sort: "alphabetical"
|
||||
americas_time:
|
||||
title: "Americas"
|
||||
type: clocks
|
||||
colors:
|
||||
rows:
|
||||
even: "lightblue"
|
||||
odd: "white"
|
||||
enabled: true
|
||||
locations:
|
||||
UTC: "Etc/UTC"
|
||||
Vancouver: "America/Vancouver"
|
||||
New_York: "America/New_York"
|
||||
Sao_Paulo: "America/Sao_Paulo"
|
||||
Denver: "America/Denver"
|
||||
Iqaluit: "America/Iqaluit"
|
||||
Bahamas: "America/Nassau"
|
||||
Chicago: "America/Chicago"
|
||||
position:
|
||||
top: 0
|
||||
left: 1
|
||||
height: 1
|
||||
width: 1
|
||||
refreshInterval: 15
|
||||
sort: "alphabetical"
|
||||
battery:
|
||||
type: power
|
||||
title: "⚡️"
|
||||
enabled: true
|
||||
position:
|
||||
top: 1
|
||||
left: 3
|
||||
height: 1
|
||||
width: 1
|
||||
refreshInterval: 15
|
||||
todolist:
|
||||
type: todo
|
||||
checkedIcon: "X"
|
||||
colors:
|
||||
checked: gray
|
||||
highlight:
|
||||
fore: "black"
|
||||
back: "orange"
|
||||
enabled: true
|
||||
filename: "todo.yml"
|
||||
position:
|
||||
top: 1
|
||||
left: 0
|
||||
height: 2
|
||||
width: 1
|
||||
refreshInterval: 3600
|
||||
ip:
|
||||
type: ipinfo
|
||||
title: "My IP"
|
||||
colors:
|
||||
name: "lightblue"
|
||||
value: "white"
|
||||
enabled: true
|
||||
position:
|
||||
top: 0
|
||||
left: 2
|
||||
height: 1
|
||||
width: 2
|
||||
refreshInterval: 150
|
||||
security_info:
|
||||
type: security
|
||||
title: "Staying safe"
|
||||
enabled: true
|
||||
position:
|
||||
top: 1
|
||||
left: 2
|
||||
height: 1
|
||||
width: 1
|
||||
refreshInterval: 3600
|
||||
readme:
|
||||
type: textfile
|
||||
enabled: true
|
||||
filePaths:
|
||||
- "~/.config/wtf/config.yml"
|
||||
format: true
|
||||
formatStyle: "monokai"
|
||||
position:
|
||||
top: 1
|
||||
left: 1
|
||||
height: 1
|
||||
width: 1
|
||||
refreshInterval: 15
|
||||
news:
|
||||
type: hackernews
|
||||
title: "HackerNews"
|
||||
enabled: true
|
||||
numberOfStories: 10
|
||||
position:
|
||||
top: 2
|
||||
left: 1
|
||||
height: 1
|
||||
width: 3
|
||||
storyType: top
|
||||
refreshInterval: 900
|
||||
resources:
|
||||
type: resourceusage
|
||||
enabled: true
|
||||
position:
|
||||
top: 3
|
||||
left: 0
|
||||
height: 2
|
||||
width: 1
|
||||
refreshInterval: 1
|
||||
uptime:
|
||||
type: cmdrunner
|
||||
args: [""]
|
||||
cmd: "uptime"
|
||||
enabled: true
|
||||
position:
|
||||
top: 4
|
||||
left: 1
|
||||
height: 1
|
||||
width: 3
|
||||
refreshInterval: 30
|
||||
disks:
|
||||
type: cmdrunner
|
||||
cmd: "df"
|
||||
args: ["-h"]
|
||||
enabled: true
|
||||
position:
|
||||
top: 3
|
||||
left: 1
|
||||
height: 1
|
||||
width: 3
|
||||
refreshInterval: 3600
|
@ -1,104 +1,89 @@
|
||||
package cfg
|
||||
|
||||
const defaultConfigFile = `wtf:
|
||||
wtf:
|
||||
colors:
|
||||
# background: gray
|
||||
border:
|
||||
focusable: darkslateblue
|
||||
focused: orange
|
||||
normal: gray
|
||||
grid:
|
||||
columns: [32, 32, 32, 32, 90]
|
||||
rows: [10, 10, 10, 4, 4, 90]
|
||||
columns: [40, 40]
|
||||
rows: [13, 13, 4, 10]
|
||||
refreshInterval: 1
|
||||
mods:
|
||||
clocks_a:
|
||||
clocks:
|
||||
colors:
|
||||
rows:
|
||||
even: "lightblue"
|
||||
odd: "white"
|
||||
enabled: true
|
||||
locations:
|
||||
Avignon: "Europe/Paris"
|
||||
Barcelona: "Europe/Madrid"
|
||||
Dubai: "Asia/Dubai"
|
||||
UTC: "Etc/UTC"
|
||||
Vancouver: "America/Vancouver"
|
||||
Toronto: "America/Toronto"
|
||||
position:
|
||||
top: 0
|
||||
left: 1
|
||||
left: 0
|
||||
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
|
||||
top: 3
|
||||
left: 0
|
||||
height: 1
|
||||
width: 1
|
||||
refreshInterval: 150
|
||||
power:
|
||||
enabled: true
|
||||
position:
|
||||
top: 2
|
||||
left: 2
|
||||
top: 3
|
||||
left: 1
|
||||
height: 1
|
||||
width: 1
|
||||
refreshInterval: 15
|
||||
title: "⚡️"
|
||||
textfile:
|
||||
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: 1
|
||||
refreshInterval: 1
|
||||
system:
|
||||
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
|
||||
`
|
||||
width: 1
|
||||
refreshInterval: 3600
|
||||
textfile:
|
||||
enabled: true
|
||||
filePaths:
|
||||
- "~/.config/wtf/config.yml"
|
||||
- "~/.config/wtf/log.txt"
|
||||
format: true
|
||||
formatStyle: "vim"
|
||||
position:
|
||||
top: 1
|
||||
left: 1
|
||||
height: 2
|
||||
width: 1
|
||||
refreshInterval: 15
|
@ -1,17 +0,0 @@
|
||||
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
|
Binary file not shown.
Before Width: | Height: | Size: 210 KiB |
@ -1,26 +1,15 @@
|
||||
wtf:
|
||||
colors:
|
||||
background: black
|
||||
border:
|
||||
focusable: darkslateblue
|
||||
grid:
|
||||
columns: [40, 40]
|
||||
rows: [16]
|
||||
refreshInterval: 1
|
||||
mods:
|
||||
americas_time:
|
||||
title: "Americas"
|
||||
type: clocks
|
||||
clocks:
|
||||
enabled: true
|
||||
locations:
|
||||
Toronto: "America/Toronto"
|
||||
UTC: "Etc/UTC"
|
||||
Vancouver: "America/Vancouver"
|
||||
New_York: "America/New_York"
|
||||
Sao_Paolo: "America/Sao_Paulo"
|
||||
Denver: "America/Denver"
|
||||
Iqaluit: "America/Iqaluit"
|
||||
Bahamas: "America/Nassau"
|
||||
Chicago: "America/Chicago"
|
||||
position:
|
||||
top: 0
|
||||
left: 0
|
||||
@ -32,6 +21,7 @@ wtf:
|
||||
enabled: true
|
||||
filePaths:
|
||||
- "~/.config/wtf/config.yml"
|
||||
- "~/.config/wtf/log.txt"
|
||||
format: true
|
||||
formatStyle: "vim"
|
||||
position:
|
||||
|
@ -1,71 +0,0 @@
|
||||
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()
|
||||
}
|
@ -1,67 +0,0 @@
|
||||
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
|
||||
}
|
@ -1,104 +0,0 @@
|
||||
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
|
||||
}
|
@ -1,71 +0,0 @@
|
||||
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,81 +0,0 @@
|
||||
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
|
||||
}
|
@ -1,102 +0,0 @@
|
||||
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)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,362 +0,0 @@
|
||||
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
|
||||
}
|
@ -1,77 +0,0 @@
|
||||
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
201
app/wtf_app.go
@ -1,201 +0,0 @@
|
||||
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,19 +5,38 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/olebedev/config"
|
||||
"golang.org/x/text/language"
|
||||
"golang.org/x/text/message"
|
||||
)
|
||||
|
||||
const (
|
||||
defaultLanguageTag = "en-CA"
|
||||
)
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
@ -29,146 +48,94 @@ type Sigils struct {
|
||||
}
|
||||
}
|
||||
|
||||
// Common defines a set of common configuration settings applicable to all modules
|
||||
type Common struct {
|
||||
Colors
|
||||
Module
|
||||
PositionSettings `help:"Defines where in the grid this module’s widget will be displayed."`
|
||||
Position
|
||||
Sigils
|
||||
|
||||
Colors ColorTheme
|
||||
Enabled bool
|
||||
RefreshInterval int
|
||||
Title string
|
||||
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"`
|
||||
focusChar int
|
||||
}
|
||||
|
||||
// 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))
|
||||
func NewCommonSettingsFromModule(name, defaultTitle string, moduleConfig *config.Config, globalSettings *config.Config) *Common {
|
||||
colorsConfig, _ := globalSettings.Get("wtf.colors")
|
||||
positionPath := "position"
|
||||
sigilsPath := "wtf.sigils"
|
||||
|
||||
common := Common{
|
||||
Colors: baseColors,
|
||||
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")),
|
||||
},
|
||||
|
||||
Module: Module{
|
||||
Name: name,
|
||||
Type: moduleConfig.UString("type", name),
|
||||
},
|
||||
|
||||
PositionSettings: NewPositionSettingsFromYAML(name, moduleConfig),
|
||||
Position: Position{
|
||||
Height: moduleConfig.UInt(positionPath + ".height"),
|
||||
Left: moduleConfig.UInt(positionPath + ".left"),
|
||||
Top: moduleConfig.UInt(positionPath + ".top"),
|
||||
Width: moduleConfig.UInt(positionPath + ".width"),
|
||||
},
|
||||
|
||||
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),
|
||||
}
|
||||
|
||||
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", "_"))
|
||||
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", "_"))
|
||||
|
||||
return &common
|
||||
}
|
||||
|
||||
/* -------------------- Exported Functions -------------------- */
|
||||
|
||||
func (common *Common) DefaultFocusedRowColor() string {
|
||||
return fmt.Sprintf(
|
||||
"%s:%s",
|
||||
common.Colors.RowTheme.HighlightedForeground,
|
||||
common.Colors.RowTheme.HighlightedBackground,
|
||||
)
|
||||
func (common *Common) DefaultFocussedRowColor() string {
|
||||
return fmt.Sprintf("%s:%s", common.Colors.HighlightFore, common.Colors.HighlightBack)
|
||||
}
|
||||
|
||||
func (common *Common) DefaultRowColor() string {
|
||||
return fmt.Sprintf(
|
||||
"%s:%s",
|
||||
common.Colors.RowTheme.EvenForeground,
|
||||
common.Colors.RowTheme.EvenBackground,
|
||||
)
|
||||
return fmt.Sprintf("%s:%s", common.Colors.Foreground, common.Colors.Background)
|
||||
}
|
||||
|
||||
// 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 {
|
||||
if common.focusChar <= 0 {
|
||||
return ""
|
||||
focusChar := string('0' + common.focusChar)
|
||||
if common.focusChar == -1 {
|
||||
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
|
||||
return focusChar
|
||||
}
|
||||
|
||||
func (common *Common) RowColor(idx int) string {
|
||||
if idx%2 == 0 {
|
||||
return common.Colors.RowTheme.EvenForeground
|
||||
return common.Colors.Rows.Even
|
||||
}
|
||||
|
||||
return common.Colors.RowTheme.OddForeground
|
||||
return common.Colors.Rows.Odd
|
||||
}
|
||||
|
||||
func (common *Common) RightAlignFormat(width int) string {
|
||||
@ -176,39 +143,16 @@ func (common *Common) RightAlignFormat(width int) string {
|
||||
return fmt.Sprintf("%%%ds", width-borderOffset)
|
||||
}
|
||||
|
||||
// PaginationMarker generates the pagination indicators that appear in the top-right corner
|
||||
// of multisource widgets
|
||||
func (common *Common) PaginationMarker(len, pos, width int) string {
|
||||
func (common *Common) SigilStr(len, pos int, width int) string {
|
||||
sigils := ""
|
||||
|
||||
if len > 1 {
|
||||
sigils = strings.Repeat(common.Sigils.Paging.Normal, pos)
|
||||
sigils += common.Sigils.Paging.Selected
|
||||
sigils += strings.Repeat(common.Sigils.Paging.Normal, len-1-pos)
|
||||
sigils = sigils + common.Sigils.Paging.Selected
|
||||
sigils = sigils + strings.Repeat(common.Sigils.Paging.Normal, len-1-pos)
|
||||
|
||||
sigils = "[lightblue]" + fmt.Sprintf(common.RightAlignFormat(width), sigils) + "[white]"
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
@ -1,194 +0,0 @@
|
||||
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,33 +11,98 @@ import (
|
||||
"github.com/olebedev/config"
|
||||
)
|
||||
|
||||
const (
|
||||
// XdgConfigDir defines the path to the minimal XDG-compatible configuration directory
|
||||
XdgConfigDir = "~/.config/"
|
||||
// ConfigDirV1 defines the path to the first version of configuration. Do not use this
|
||||
const ConfigDirV1 = "~/.wtf/"
|
||||
|
||||
// WtfConfigDirV1 defines the path to the first version of configuration. Do not use this
|
||||
WtfConfigDirV1 = "~/.wtf/"
|
||||
// ConfigDirV2 defines the path to the second version of the configuration. Use this.
|
||||
const ConfigDirV2 = "~/.config/wtf/"
|
||||
|
||||
// WtfConfigDirV2 defines the path to the second version of the configuration. Use this.
|
||||
WtfConfigDirV2 = "~/.config/wtf/"
|
||||
/* -------------------- Config Migration -------------------- */
|
||||
|
||||
// WtfConfigFile defines the name of the default config file
|
||||
WtfConfigFile = "config.yml"
|
||||
)
|
||||
// MigrateOldConfig copies any existing configuration from the old location
|
||||
// to the new, XDG-compatible location
|
||||
func MigrateOldConfig() {
|
||||
srcDir, _ := expandHomeDir(ConfigDirV1)
|
||||
destDir, _ := expandHomeDir(ConfigDirV2)
|
||||
|
||||
/* -------------------- Exported Functions -------------------- */
|
||||
// If the old config directory doesn't exist, do not move
|
||||
if _, err := os.Stat(srcDir); os.IsNotExist(err) {
|
||||
return
|
||||
}
|
||||
|
||||
// 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, returns the absolute path to the file
|
||||
// If unsuccessful, returns an error
|
||||
func CreateFile(fileName string) (string, error) {
|
||||
configDir, err := WtfConfigDir()
|
||||
// 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
|
||||
}
|
||||
|
||||
filePath := filepath.Join(configDir, fileName)
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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 unsuccessful, returns an error
|
||||
func CreateFile(fileName string) (string, error) {
|
||||
configDir, err := ConfigDir()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
filePath := fmt.Sprintf("%s/%s", configDir, fileName)
|
||||
|
||||
// Check if the file already exists; if it does not, create it
|
||||
_, err = os.Stat(filePath)
|
||||
@ -55,105 +120,87 @@ func CreateFile(fileName string) (string, error) {
|
||||
return filePath, nil
|
||||
}
|
||||
|
||||
// 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 {
|
||||
// LoadConfigFile loads the config.yml file to configure the app
|
||||
func LoadConfigFile(filePath string) *config.Config {
|
||||
absPath, _ := expandHomeDir(filePath)
|
||||
|
||||
cfg, err := config.ParseYamlFile(absPath)
|
||||
if err != nil {
|
||||
displayWtfConfigFileLoadError(absPath, err)
|
||||
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())
|
||||
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.
|
||||
@ -191,34 +238,3 @@ 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 func() { _ = f.Close() }()
|
||||
defer f.Close()
|
||||
|
||||
if err = os.Chmod(f.Name(), info.Mode()); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
s, err := os.Open(filepath.Clean(src))
|
||||
s, err := os.Open(src)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() { _ = f.Close() }()
|
||||
defer s.Close()
|
||||
|
||||
_, err = io.Copy(f, s)
|
||||
return err
|
||||
|
@ -1,109 +0,0 @@
|
||||
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
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
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"))
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
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)
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
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
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
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))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
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
|
||||
}
|
@ -1,67 +0,0 @@
|
||||
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
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
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
224
cfg/secrets.go
@ -1,224 +0,0 @@
|
||||
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),
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
package cfg
|
||||
|
||||
// Validatable is implemented by any value that validates a configuration setting
|
||||
type Validatable interface {
|
||||
Error() error
|
||||
HasError() bool
|
||||
String() string
|
||||
IntValue() int
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
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
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
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,8 +22,7 @@ func NewChecklist(checkedIcon, uncheckedIcon string) Checklist {
|
||||
|
||||
/* -------------------- Exported Functions -------------------- */
|
||||
|
||||
// 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
|
||||
// Add creates a new item in the checklist
|
||||
func (list *Checklist) Add(checked bool, text string) {
|
||||
item := NewChecklistItem(
|
||||
checked,
|
||||
@ -49,10 +48,24 @@ func (list *Checklist) CheckedItems() []*ChecklistItem {
|
||||
}
|
||||
|
||||
// Delete removes the selected item from the checklist
|
||||
func (list *Checklist) Delete(selectedIndex int) {
|
||||
if selectedIndex >= 0 && selectedIndex < len(list.Items) {
|
||||
list.Items = append(list.Items[:selectedIndex], list.Items[selectedIndex+1:]...)
|
||||
func (list *Checklist) Delete() {
|
||||
list.Items = append(list.Items[:list.selected], list.Items[list.selected+1:]...)
|
||||
list.Prev()
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
// IsSelectable returns true if the checklist has selectable items, false if it does not
|
||||
@ -65,6 +78,14 @@ func (list *Checklist) IsUnselectable() bool {
|
||||
return !list.IsSelectable()
|
||||
}
|
||||
|
||||
// Next selects the next item in the checklist
|
||||
func (list *Checklist) Next() {
|
||||
list.selected = list.selected + 1
|
||||
if list.selected >= len(list.Items) {
|
||||
list.selected = 0
|
||||
}
|
||||
}
|
||||
|
||||
// LongestLine returns the length of the longest checklist item's text
|
||||
func (list *Checklist) LongestLine() int {
|
||||
maxLen := 0
|
||||
@ -78,14 +99,58 @@ func (list *Checklist) LongestLine() int {
|
||||
return maxLen
|
||||
}
|
||||
|
||||
// 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) {
|
||||
// Prev selects the previous item in the checklist
|
||||
func (list *Checklist) Prev() {
|
||||
list.selected = list.selected - 1
|
||||
if list.selected < 0 {
|
||||
list.selected = len(list.Items) - 1
|
||||
}
|
||||
}
|
||||
|
||||
// Promote moves the selected item up in the checklist
|
||||
func (list *Checklist) Promote() {
|
||||
if list.IsUnselectable() {
|
||||
return
|
||||
}
|
||||
|
||||
j := list.selected - 1
|
||||
if j < 0 {
|
||||
j = len(list.Items) - 1
|
||||
}
|
||||
|
||||
list.Swap(list.selected, j)
|
||||
list.selected = j
|
||||
}
|
||||
|
||||
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) {
|
||||
for idx, item := range list.Items {
|
||||
if item == selectableItem {
|
||||
return idx, true
|
||||
list.selected = idx
|
||||
break
|
||||
}
|
||||
}
|
||||
return 0, false
|
||||
}
|
||||
|
||||
// Toggle switches the checked state of the currently-selected item
|
||||
func (list *Checklist) Toggle() {
|
||||
if list.IsUnselectable() {
|
||||
return
|
||||
}
|
||||
|
||||
list.SelectedItem().Toggle()
|
||||
}
|
||||
|
||||
// UncheckedItems returns a slice of all the unchecked items
|
||||
@ -106,6 +171,17 @@ 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
|
||||
}
|
||||
|
||||
/* -------------------- Sort Interface -------------------- */
|
||||
|
||||
func (list *Checklist) Len() int {
|
||||
|
@ -1,5 +1,7 @@
|
||||
package checklist
|
||||
|
||||
import ()
|
||||
|
||||
// ChecklistItem is a module for creating generic checklist implementations
|
||||
// See 'Todo' for an implementation example
|
||||
type ChecklistItem struct {
|
||||
|
@ -1,36 +0,0 @@
|
||||
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)
|
||||
}
|
@ -1,436 +0,0 @@
|
||||
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")
|
||||
})
|
||||
}
|
||||
}
|
31
checklist_tests/checklist_item_test.go
Normal file
31
checklist_tests/checklist_item_test.go
Normal file
@ -0,0 +1,31 @@
|
||||
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)
|
||||
}
|
116
flags/flags.go
116
flags/flags.go
@ -4,42 +4,19 @@ 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/wtf"
|
||||
)
|
||||
|
||||
// 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.: 'wtfutil -m=todo'"`
|
||||
Module string `short:"m" long:"module" optional:"yes" description:"Display info about a specific module, i.e.: 'wtf -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
|
||||
@ -47,114 +24,51 @@ func NewFlags() *Flags {
|
||||
|
||||
/* -------------------- Exported Functions -------------------- */
|
||||
|
||||
// ConfigFilePath returns the path to the currently-loaded config file
|
||||
func (flags *Flags) ConfigFilePath() string {
|
||||
return flags.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) {
|
||||
func (flags *Flags) Display(version string) {
|
||||
if flags.HasModule() {
|
||||
help.Display(flags.Module, config)
|
||||
help.Display(flags.Module)
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
if flags.HasVersion() {
|
||||
fmt.Printf("%s (%s)\n", version, date)
|
||||
fmt.Println(version)
|
||||
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)
|
||||
func (flags *Flags) HasConfig() bool {
|
||||
return len(flags.Config) > 0
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
return flags.Version == true
|
||||
}
|
||||
|
||||
// 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 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 no config file is explicitly passed in as a param,
|
||||
// set the flag to the default config file
|
||||
if !flags.HasConfig() {
|
||||
homeDir, err := wtf.Home()
|
||||
if err != nil {
|
||||
fmt.Printf("Error: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
flags.Config = filepath.Join(configDir, "config.yml")
|
||||
|
||||
flags.Config = filepath.Join(homeDir, ".config", "wtf", "config.yml")
|
||||
}
|
||||
}
|
||||
|
@ -1,29 +0,0 @@
|
||||
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,41 +36,17 @@ func main() {
|
||||
widgetName,
|
||||
}
|
||||
|
||||
createModuleDirectory(data)
|
||||
|
||||
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())
|
||||
}
|
||||
}
|
||||
|
||||
func generateWidgetFile(data struct{ Name string }) {
|
||||
tpl, _ := template.New("textwidget.tpl").Funcs(template.FuncMap{
|
||||
"Lower": strings.ToLower,
|
||||
"Title": strings.Title,
|
||||
}).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)))
|
||||
err := os.Mkdir(strings.ToLower(widgetName), os.ModePerm)
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
|
||||
out, err := os.Create(fmt.Sprintf("%s/widget.go", strings.ToLower(widgetName)))
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
|
@ -1,45 +1,71 @@
|
||||
// Package {{(Lower .Name)}}
|
||||
package {{(Lower .Name)}}
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/gdamore/tcell"
|
||||
"github.com/rivo/tview"
|
||||
"github.com/wtfutil/wtf/view"
|
||||
"github.com/wtfutil/wtf/wtf"
|
||||
)
|
||||
|
||||
// Widget is the container for your module's data
|
||||
type Widget struct {
|
||||
view.TextWidget
|
||||
const HelpText = `
|
||||
Keyboard commands for {{(Title .Name)}}:
|
||||
`
|
||||
|
||||
type Widget struct {
|
||||
wtf.HelpfulWidget
|
||||
wtf.KeyboardWidget
|
||||
wtf.TextWidget
|
||||
|
||||
app *tview.Application
|
||||
settings *Settings
|
||||
}
|
||||
|
||||
// NewWidget creates and returns an instance of Widget
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(tviewApp, settings.common),
|
||||
HelpfulWidget: wtf.NewHelpfulWidget(app, pages, HelpText),
|
||||
KeyboardWidget: wtf.NewKeyboardWidget(),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common, false),
|
||||
|
||||
app: app,
|
||||
settings: settings,
|
||||
}
|
||||
|
||||
widget.initializeKeyboardControls()
|
||||
widget.View.SetInputCapture(widget.InputCapture)
|
||||
|
||||
widget.unselect()
|
||||
|
||||
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.app.QueueUpdateDraw(func() {
|
||||
widget.display()
|
||||
})
|
||||
}
|
||||
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
|
||||
func (widget *Widget) content() string {
|
||||
return "This is my widget"
|
||||
func (widget *Widget) display() {
|
||||
widget.View.SetWrap(false)
|
||||
|
||||
widget.View.Clear()
|
||||
widget.View.SetText("Some Text")
|
||||
widget.View.Highlight(strconv.Itoa(widget.selected)).ScrollToHighlight()
|
||||
}
|
||||
|
||||
func (widget *Widget) display() {
|
||||
widget.Redraw(func() (string, string, bool) {
|
||||
return widget.CommonSettings().Title, widget.content(), false
|
||||
})
|
||||
func (widget *Widget) unselect() {
|
||||
widget.selected = -1
|
||||
widget.display()
|
||||
}
|
122
go.mod
122
go.mod
@ -1,86 +1,52 @@
|
||||
module github.com/wtfutil/wtf
|
||||
|
||||
go 1.16
|
||||
go 1.12
|
||||
|
||||
require (
|
||||
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
|
||||
cloud.google.com/go v0.34.0
|
||||
code.cloudfoundry.org/bytefmt v0.0.0-20180906201452-2aa6f33b730c
|
||||
github.com/PagerDuty/go-pagerduty v0.0.0-20180528123509-b4a4067bdbde
|
||||
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6
|
||||
github.com/adlio/trello v0.0.0-20181009211147-e4cc07c871d0
|
||||
github.com/alecthomas/chroma v0.6.2
|
||||
github.com/andygrunwald/go-gerrit v0.0.0-20190110184452-f48c3d16616f
|
||||
github.com/briandowns/openweathermap v0.0.0-20180804155945-5f41b7c9d92d
|
||||
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/cenkalti/backoff v2.1.1+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/dustin/go-humanize v1.0.0
|
||||
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/gdamore/encoding v1.0.0
|
||||
github.com/gdamore/tcell v0.0.0-20190412054914-dcf1bb30770e
|
||||
github.com/go-ole/go-ole v1.2.2
|
||||
github.com/go-test/deep v1.0.1 // indirect
|
||||
github.com/godbus/dbus v0.0.0-20181101234600-2ff6f7ffd60f
|
||||
github.com/golang/protobuf v1.2.0
|
||||
github.com/google/go-github/v25 v25.0.1
|
||||
github.com/google/go-querystring v1.0.0
|
||||
github.com/jessevdk/go-flags v1.4.0
|
||||
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
|
||||
github.com/lucasb-eyer/go-colorful v1.0.2
|
||||
github.com/mattn/go-runewidth v0.0.4
|
||||
github.com/olebedev/config v0.0.0-20180910155717-57f804269e64
|
||||
github.com/pkg/errors v0.8.1
|
||||
github.com/pkg/profile v1.2.1
|
||||
github.com/pmezard/go-difflib v1.0.0
|
||||
github.com/radovskyb/watcher v1.0.5
|
||||
github.com/rivo/tview v0.0.0-20181226202439-36893a669792
|
||||
github.com/shirou/gopsutil v2.18.12+incompatible
|
||||
github.com/sticreations/spotigopher v0.0.0-20181009182052-98632f6f94b0
|
||||
github.com/stretchr/testify v1.3.0
|
||||
github.com/xanzy/go-gitlab v0.0.0-20190111184316-d85a15301260
|
||||
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.19.0+incompatible
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a
|
||||
golang.org/x/oauth2 v0.0.0-20190111185915-36a7019397c4
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a
|
||||
golang.org/x/text v0.3.0
|
||||
google.golang.org/api v0.0.0-20190111181425-455dee39f703
|
||||
google.golang.org/appengine v1.4.0
|
||||
gopkg.in/jarcoal/httpmock.v1 v1.0.0-20190314184232-a8ac0a50d0b5 // indirect
|
||||
gopkg.in/yaml.v2 v2.2.2
|
||||
)
|
||||
|
||||
// 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
|
||||
|
49
help/help.go
49
help/help.go
@ -3,38 +3,37 @@ package help
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/olebedev/config"
|
||||
"github.com/wtfutil/wtf/app"
|
||||
"github.com/wtfutil/wtf/utils"
|
||||
"github.com/wtfutil/wtf/modules/git"
|
||||
"github.com/wtfutil/wtf/modules/github"
|
||||
"github.com/wtfutil/wtf/modules/textfile"
|
||||
"github.com/wtfutil/wtf/modules/todo"
|
||||
"github.com/wtfutil/wtf/modules/todoist"
|
||||
"github.com/wtfutil/wtf/modules/weatherservices/weather"
|
||||
)
|
||||
|
||||
// Display displays the output of the --help argument
|
||||
func Display(moduleName string, cfg *config.Config) {
|
||||
func Display(moduleName string) {
|
||||
if moduleName == "" {
|
||||
fmt.Println("\n --module takes a module name as an argument, i.e: '--module=github'")
|
||||
} else {
|
||||
fmt.Printf("%s\n", helpFor(moduleName, cfg))
|
||||
fmt.Printf("%s\n", helpFor(moduleName))
|
||||
}
|
||||
}
|
||||
|
||||
func helpFor(moduleName string, cfg *config.Config) string {
|
||||
err := cfg.Set("wtf.mods."+moduleName+".enabled", true)
|
||||
if err != nil {
|
||||
return ""
|
||||
func helpFor(moduleName string) string {
|
||||
switch moduleName {
|
||||
case "git":
|
||||
return git.HelpText
|
||||
case "github":
|
||||
return github.HelpText
|
||||
case "textfile":
|
||||
return textfile.HelpText
|
||||
case "todo":
|
||||
return todo.HelpText
|
||||
case "todoist":
|
||||
return todoist.HelpText
|
||||
case "weather":
|
||||
return weather.HelpText
|
||||
default:
|
||||
return fmt.Sprintf("\n There is no help available for '%s'", moduleName)
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 59 KiB |
113
logger/log.go
113
logger/log.go
@ -1,37 +1,136 @@
|
||||
package logger
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/rivo/tview"
|
||||
"github.com/wtfutil/wtf/wtf"
|
||||
)
|
||||
|
||||
const maxBufferSize int64 = 1024
|
||||
|
||||
type Widget struct {
|
||||
wtf.TextWidget
|
||||
|
||||
app *tview.Application
|
||||
filePath string
|
||||
settings *Settings
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common, true),
|
||||
|
||||
app: app,
|
||||
filePath: logFilePath(),
|
||||
settings: settings,
|
||||
}
|
||||
|
||||
return &widget
|
||||
}
|
||||
|
||||
/* -------------------- Exported Functions -------------------- */
|
||||
|
||||
func Log(msg string) {
|
||||
if LogFileMissing() {
|
||||
if logFileMissing() {
|
||||
return
|
||||
}
|
||||
|
||||
f, err := os.OpenFile(LogFilePath(), os.O_RDWR|os.O_CREATE|os.O_APPEND, 0600)
|
||||
f, err := os.OpenFile(logFilePath(), os.O_RDWR|os.O_CREATE|os.O_APPEND, 0600)
|
||||
if err != nil {
|
||||
log.Fatalf("error opening file: %v", err)
|
||||
}
|
||||
defer func() { _ = f.Close() }()
|
||||
defer f.Close()
|
||||
|
||||
log.SetOutput(f)
|
||||
log.Println(msg)
|
||||
}
|
||||
|
||||
func LogFileMissing() bool {
|
||||
return LogFilePath() == ""
|
||||
// Refresh updates the onscreen contents of the widget
|
||||
func (widget *Widget) Refresh() {
|
||||
if logFileMissing() {
|
||||
return
|
||||
}
|
||||
|
||||
func LogFilePath() string {
|
||||
dir, err := os.UserHomeDir()
|
||||
logLines := widget.tailFile()
|
||||
|
||||
widget.app.QueueUpdateDraw(func() {
|
||||
widget.View.SetTitle(widget.CommonSettings.Title)
|
||||
widget.View.SetText(widget.contentFrom(logLines))
|
||||
})
|
||||
}
|
||||
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
|
||||
func (widget *Widget) contentFrom(logLines []string) string {
|
||||
str := ""
|
||||
|
||||
for _, line := range logLines {
|
||||
chunks := strings.Split(line, " ")
|
||||
|
||||
if len(chunks) >= 4 {
|
||||
str = str + fmt.Sprintf(
|
||||
"[green]%s[white] [yellow]%s[white] %s\n",
|
||||
chunks[0],
|
||||
chunks[1],
|
||||
strings.Join(chunks[3:], " "),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return str
|
||||
}
|
||||
|
||||
func logFileMissing() bool {
|
||||
return logFilePath() == ""
|
||||
}
|
||||
|
||||
func logFilePath() string {
|
||||
dir, err := wtf.Home()
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
|
||||
return filepath.Join(dir, ".config", "wtf", "log.txt")
|
||||
}
|
||||
|
||||
func (widget *Widget) tailFile() []string {
|
||||
file, err := os.Open(widget.filePath)
|
||||
if err != nil {
|
||||
return []string{}
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
stat, err := file.Stat()
|
||||
if err != nil {
|
||||
return []string{}
|
||||
}
|
||||
|
||||
bufferSize := maxBufferSize
|
||||
if maxBufferSize > stat.Size() {
|
||||
bufferSize = stat.Size()
|
||||
}
|
||||
|
||||
startPos := stat.Size() - bufferSize
|
||||
|
||||
buff := make([]byte, bufferSize)
|
||||
_, err = file.ReadAt(buff, startPos)
|
||||
if err != nil {
|
||||
return []string{}
|
||||
}
|
||||
|
||||
logLines := strings.Split(string(buff), "\n")
|
||||
|
||||
// Reverse the array of lines
|
||||
// Offset by two to account for the blank line at the end
|
||||
last := len(logLines) - 2
|
||||
for i := 0; i < len(logLines)/2; i++ {
|
||||
logLines[i], logLines[last-i] = logLines[last-i], logLines[i]
|
||||
}
|
||||
|
||||
return logLines
|
||||
}
|
||||
|
@ -5,18 +5,15 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const (
|
||||
defaultFocusable = true
|
||||
defaultTitle = "Logger"
|
||||
)
|
||||
const defaultTitle = "Logger"
|
||||
|
||||
type Settings struct {
|
||||
*cfg.Common
|
||||
common *cfg.Common
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||
settings := Settings{
|
||||
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
|
||||
}
|
||||
|
||||
return &settings
|
148
main.go
148
main.go
@ -1,65 +1,155 @@
|
||||
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"
|
||||
|
||||
// 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/gdamore/tcell"
|
||||
"github.com/pkg/profile"
|
||||
|
||||
"github.com/wtfutil/wtf/app"
|
||||
"github.com/radovskyb/watcher"
|
||||
"github.com/rivo/tview"
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
"github.com/wtfutil/wtf/flags"
|
||||
"github.com/wtfutil/wtf/utils"
|
||||
"github.com/wtfutil/wtf/maker"
|
||||
"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 {
|
||||
switch event.Key() {
|
||||
case tcell.KeyCtrlR:
|
||||
refreshAllWidgets(runningWidgets)
|
||||
case tcell.KeyTab:
|
||||
focusTracker.Next()
|
||||
case tcell.KeyBacktab:
|
||||
focusTracker.Prev()
|
||||
case tcell.KeyEsc:
|
||||
focusTracker.None()
|
||||
}
|
||||
|
||||
if focusTracker.FocusOn(string(event.Rune())) {
|
||||
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, _ := wtf.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()
|
||||
flags.Display(version)
|
||||
|
||||
// Load the configuration file
|
||||
cfg.Initialize(flags.HasCustomConfig())
|
||||
config := cfg.LoadWtfConfigFile(flags.ConfigFilePath())
|
||||
cfg.MigrateOldConfig()
|
||||
cfg.CreateConfigDir()
|
||||
cfg.CreateConfigFile()
|
||||
|
||||
wtf.SetTerminal(config)
|
||||
|
||||
flags.RenderIf(version, date, config)
|
||||
config := cfg.LoadConfigFile(flags.ConfigFilePath())
|
||||
|
||||
if flags.Profile {
|
||||
defer profile.Start(profile.MemProfile).Stop()
|
||||
}
|
||||
|
||||
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()
|
||||
err := os.Setenv("TERM", config.UString("wtf.term", os.Getenv("TERM")))
|
||||
if err != nil {
|
||||
fmt.Printf("\n%s %v\n", aurora.Red("ERROR"), err)
|
||||
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)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
currentApp.Run()
|
||||
}
|
||||
|
225
maker/widget_maker.go
Normal file
225
maker/widget_maker.go
Normal file
@ -0,0 +1,225 @@
|
||||
package maker
|
||||
|
||||
import (
|
||||
"github.com/olebedev/config"
|
||||
"github.com/rivo/tview"
|
||||
"github.com/wtfutil/wtf/logger"
|
||||
"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/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/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/system"
|
||||
"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, 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 "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 "system":
|
||||
// settings := system.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||
// widget = system.NewWidget(app, date, version, 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, 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
|
||||
}
|
@ -1,280 +0,0 @@
|
||||
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
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
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")
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
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
|
||||
}
|
@ -1,259 +0,0 @@
|
||||
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()
|
||||
}
|
||||
}
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
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
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
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)
|
||||
|
||||
|
@ -1,42 +0,0 @@
|
||||
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
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
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,6 +2,7 @@ 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 func() { _ = resp.Body.Close() }()
|
||||
defer resp.Body.Close()
|
||||
|
||||
data, err := ParseBody(resp)
|
||||
if err != nil {
|
||||
|
@ -7,27 +7,23 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const (
|
||||
defaultFocusable = false
|
||||
defaultTitle = "BambooHR"
|
||||
)
|
||||
const defaultTitle = "BambooHR"
|
||||
|
||||
type Settings struct {
|
||||
*cfg.Common
|
||||
common *cfg.Common
|
||||
|
||||
apiKey string `help:"Your BambooHR API token."`
|
||||
subdomain string `help:"Your BambooHR API subdomain name."`
|
||||
apiKey string
|
||||
subdomain string
|
||||
}
|
||||
|
||||
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", ymlConfig.UString("apikey", os.Getenv("WTF_BAMBOO_HR_TOKEN"))),
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
|
||||
|
||||
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,27 +2,25 @@ 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 {
|
||||
view.TextWidget
|
||||
wtf.TextWidget
|
||||
|
||||
app *tview.Application
|
||||
settings *Settings
|
||||
items []Item
|
||||
}
|
||||
|
||||
func NewWidget(tviewApp *tview.Application, settings *Settings) *Widget {
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(tviewApp, nil, settings.Common),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common, false),
|
||||
|
||||
app: app,
|
||||
settings: settings,
|
||||
}
|
||||
|
||||
@ -33,33 +31,36 @@ func NewWidget(tviewApp *tview.Application, settings *Settings) *Widget {
|
||||
|
||||
func (widget *Widget) Refresh() {
|
||||
client := NewClient(
|
||||
apiURI,
|
||||
APIURI,
|
||||
widget.settings.apiKey,
|
||||
widget.settings.subdomain,
|
||||
)
|
||||
|
||||
widget.items = client.Away(
|
||||
todayItems := client.Away(
|
||||
"timeOff",
|
||||
time.Now().Local().Format(wtf.DateFormat),
|
||||
time.Now().Local().Format(wtf.DateFormat),
|
||||
wtf.Now().Format(wtf.DateFormat),
|
||||
wtf.Now().Format(wtf.DateFormat),
|
||||
)
|
||||
|
||||
widget.Redraw(widget.content)
|
||||
widget.app.QueueUpdateDraw(func() {
|
||||
widget.View.SetTitle(widget.ContextualTitle(widget.CommonSettings.Title))
|
||||
widget.View.SetText(widget.contentFrom(todayItems))
|
||||
})
|
||||
}
|
||||
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
|
||||
func (widget *Widget) content() (string, string, bool) {
|
||||
str := ""
|
||||
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)
|
||||
}
|
||||
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))
|
||||
}
|
||||
|
||||
return widget.CommonSettings().Title, str, false
|
||||
str := ""
|
||||
for _, item := range items {
|
||||
str = str + widget.format(item)
|
||||
}
|
||||
|
||||
return str
|
||||
}
|
||||
|
||||
func (widget *Widget) format(item Item) string {
|
||||
|
@ -5,18 +5,15 @@ import (
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
const (
|
||||
defaultFocusable = false
|
||||
defaultTitle = "Bargraph"
|
||||
)
|
||||
const defaultTitle = "Bargraph"
|
||||
|
||||
type Settings struct {
|
||||
*cfg.Common
|
||||
common *cfg.Common
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||
settings := Settings{
|
||||
Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
|
||||
}
|
||||
|
||||
return &settings
|
||||
|
@ -5,27 +5,29 @@ This is a demo bargraph that just populates some random date/val data
|
||||
*/
|
||||
|
||||
import (
|
||||
"github.com/rivo/tview"
|
||||
"math/rand"
|
||||
"time"
|
||||
|
||||
"github.com/rivo/tview"
|
||||
|
||||
"github.com/wtfutil/wtf/view"
|
||||
"github.com/wtfutil/wtf/wtf"
|
||||
)
|
||||
|
||||
var started = false
|
||||
var ok = true
|
||||
|
||||
// Widget define wtf widget to register widget later
|
||||
type Widget struct {
|
||||
view.BarGraph
|
||||
wtf.BarGraph
|
||||
|
||||
tviewApp *tview.Application
|
||||
app *tview.Application
|
||||
}
|
||||
|
||||
// NewWidget Make new instance of widget
|
||||
func NewWidget(tviewApp *tview.Application, settings *Settings) *Widget {
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
BarGraph: view.NewBarGraph(tviewApp, "Sample Bar Graph", settings.Common),
|
||||
BarGraph: wtf.NewBarGraph(app, "Sample Bar Graph", settings.common, false),
|
||||
|
||||
tviewApp: tviewApp,
|
||||
app: app,
|
||||
}
|
||||
|
||||
widget.View.SetWrap(true)
|
||||
@ -41,16 +43,15 @@ func MakeGraph(widget *Widget) {
|
||||
|
||||
//this could come from config
|
||||
const lineCount = 8
|
||||
var stats [lineCount]view.Bar
|
||||
var stats [lineCount]wtf.Bar
|
||||
|
||||
barTime := time.Now()
|
||||
for i := 0; i < lineCount; i++ {
|
||||
barTime = barTime.Add(time.Minute)
|
||||
barTime = barTime.Add(time.Duration(time.Minute))
|
||||
|
||||
bar := view.Bar{
|
||||
bar := wtf.Bar{
|
||||
Label: barTime.Format("15:04"),
|
||||
Percent: rand.Intn(100-5) + 5,
|
||||
LabelColor: "red",
|
||||
}
|
||||
|
||||
stats[i] = bar
|
||||
@ -69,7 +70,7 @@ func (widget *Widget) Refresh() {
|
||||
|
||||
widget.View.Clear()
|
||||
|
||||
widget.tviewApp.QueueUpdateDraw(func() {
|
||||
widget.app.QueueUpdateDraw(func() {
|
||||
display(widget)
|
||||
})
|
||||
|
||||
|
@ -1,108 +0,0 @@
|
||||
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
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
package buildkite
|
||||
|
||||
func (widget *Widget) initializeKeyboardControls() {
|
||||
widget.InitializeHelpTextKeyboardControl(widget.ShowHelp)
|
||||
widget.InitializeRefreshKeyboardControl(widget.Refresh)
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
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"
|
||||
}
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
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
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
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
|
||||
}
|
@ -1,92 +0,0 @@
|
||||
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"
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
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")
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
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
|
||||
}
|
@ -1,143 +0,0 @@
|
||||
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)
|
||||
}
|
||||
}
|
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