Last active
August 24, 2018 13:02
-
-
Save henrahmagix/2307fd03410fec17f43206f74e9d1096 to your computer and use it in GitHub Desktop.
Order logs from Google Cloudbuild bookmark (copy-paste into new bookmark, click to run)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function (el) { if (!el) { throw new Error('no el'); } var text = el.innerText; if (!text) { throw new Error('no text for', el); } var rAll = /Step #(\d+)/; var match = function (s, r) { var m = s.match(r); return m && m[1]; }; var steps = {}; var lines = []; text.split('\n').forEach(s => { var m = match(s, rAll); if (!m) { lines.push(s); } else if (!steps[m]) { steps[m] = [s]; } else { steps[m].push(s); } }); Object.keys(steps).map(ns => parseInt(ns, 10)).sort((a,b) => a-b).forEach(n => { lines.push(steps[n].join('\n')) }); el.innerText = lines.join('\n'); })(document.querySelector('pre')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment