{"_id":"wopr","_rev":"13-51c83a72d492d02ed4798b06dfff8a02","name":"wopr","time":{"modified":"2022-06-29T03:09:26.145Z","created":"2013-11-24T02:30:03.996Z","0.0.0":"2013-11-24T02:30:07.102Z","0.0.1":"2015-07-17T17:21:59.816Z","0.0.2":"2015-07-18T15:12:35.675Z","0.0.3":"2015-07-22T21:29:41.735Z","0.0.4":"2016-04-01T17:40:29.860Z","0.0.5":"2016-04-01T17:48:35.059Z"},"maintainers":[{"name":"yaron","email":"yaronn01@gmail.com"}],"dist-tags":{"latest":"0.0.5"},"readme":"# WOPR\r\n\r\nWOPR is a simple markup language for creating [rich terminal reports](https://github.com/yaronn/blessed-contrib), presentations and infographics.\r\n\r\nPut [a report](https://raw.githubusercontent.com/yaronn/wopr/master/examples/sample.xml) on the web (e.g. gist) and view it via curl:\r\n\r\n`````bash\r\n$> curl -N tty.zone/\\[0-2\\]\\?auto\\&cols=$((COLUMNS))\r\n`````\r\n(If you experience firewall issues replace tty.zone with ec2-23-21-64-152.compute-1.amazonaws.com or use a [local viewer](https://github.com/yaronn/wopr#viewing-reports))\r\n\r\nCreated by Yaron Naveh ([@YaronNaveh](https://twitter.com/YaronNaveh))\r\n\r\n![](./examples/images/charts.png \"term\")\r\n![](./examples/images/map.png \"term\")\r\n\r\n##Writing your first terminal report##\r\n\r\nHere is a simple report with a bar chart:\r\n\r\n`````xml\r\n<document>\r\n  <page>\r\n    <item col=\"0\" row=\"0\" colSpan=\"5\" rowSpan=\"4\">\r\n      <bar maxHeight=\"5\" data-titles=\"A,B,C\" data-data=\"2,5,3\" />\r\n    </item>\r\n  </page>\r\n</document>\r\n`````\r\n\r\nYou have 3 options to view this report:\r\n\r\n**Option 1: POST it to the wopr online viewer**\r\n\r\n`````bash\r\n$> curl --data '<document><page><item col=\"0\" row=\"0\" colSpan=\"5\" rowSpan=\"4\"><bar maxHeight=\"5\" data-titles=\"A,B,C\" data-data=\"2,5,3\" /></item></page></document>' tty.zone\\?cols=$((COLUMNS))\r\n`````\r\n\r\nIf you experience firewall issues replace tty.zone with ec2-23-21-64-152.compute-1.amazonaws.com.\r\n\r\n**Note:** The online viewer is a reference implementation. Do not send it secret data but rather create [your own](https://github.com/yaronn/wopr/tree/master/server).\r\n\r\n**Option 2: POST it from external url**\r\n\r\nSave the report content in some url (e.g. gist) and then:\r\n\r\n`````bash\r\n$> a=$(curl -s https://gist.githubusercontent.com/yaronn/e6eec6d0e7adac63c83f/raw/50aca544d26a32aa189e790635c8679067017948/gistfile1.xml); curl --data \"$a\" tty.zone\\?cols=$((COLUMNS))\r\n`````\r\n\r\n(note you need the gist raw url)\r\n\r\nIf you experience firewall issues replace tty.zone with ec2-23-21-64-152.compute-1.amazonaws.com.\r\n\r\n**Note:** The online viewer is a reference implementation. Do not send it secret data but rather create [your own](https://github.com/yaronn/wopr/tree/master/server).\r\n\r\n\r\n**Option 3: Via the local viewer**\r\n\r\nSave the report xml to report.xml and then:\r\n\r\n`````bash\r\n$> npm install -g wopr\r\n$> wopr report.xml\r\n`````\r\n\r\nNote the local viewer does not send anything online and does not require network.\r\n\r\n![](./examples/images/charts.png \"term\")\r\n\r\n##Markup Basics#\r\n\r\n**Pages**\r\n\r\nA document is a set of pages:\r\n\r\n`````xml\r\n<document>\r\n  <page>\r\n    ...\r\n  </page>\r\n  <page>\r\n    ...\r\n  </page>\r\n</document>\r\n`````\r\n\r\n**Layout**\r\n\r\nA page is a 12x12 grid in which you can position different widgets:\r\n\r\n`````xml\r\n<document>\r\n  <page>\r\n    <item col=\"0\" row=\"0\" colSpan=\"3\" rowSpan=\"3\">\r\n      <bar maxHeight=\"5\" data-titles=\"A,B,C\" data-data=\"2,5,3\" />\r\n    </item>\r\n    <item col=\"5\" row=\"9\" colSpan=\"1\" rowSpan=\"1\">\r\n      <box content=\"some text\" />\r\n    </item>\r\n  </page>\r\n</document>\r\n`````\r\n\r\nHere, the bar widget is in the first column and row (0-based indexing) and spans three columns and rows.\r\nThe box element is in the same page but in a different position.\r\n\r\n\r\n**Widgets**\r\n\r\nThe available widgets are the ones that exist in the [blessed](https://github.com/chjj/blessed) and [blessed-contrib](https://github.com/yaronn/blessed-contrib) projects.\r\nYou can infer the xml representation of a javascript widget using a simple convention. Assume that you would instantiate some blessed widget with this javascript:\r\n\r\n`````javascript\r\nblessed.widget({ string: \"5\"\r\n               , int: 1\r\n               , intArray: [1,2,3]\r\n               , stringArray: [\"a\", \"b\", \"c\"]\r\n               , multiArray: [ [1,2,3], [4,5,6] ]\r\n               , complexArray: [ {a: 1, b: [1,2] }, {a: 3, b: [3,4]} ]\r\n               , object: { innerProp: 1, multiArray: [ [1,2], [3,4] ] }\r\n})\r\n`````\r\n\r\nThen here is how you would represent it in xml:\r\n    \r\n`````xml\r\n<widget string=\"5\" int=\"1\" intArray=\"1,2,3\" stringArray=\"a,b,c\" object-innerProp=\"1\">\r\n  <multiArray>\r\n    1,2,3\r\n    4,5,6\r\n  </multiArray>\r\n  <object-multiArray>\r\n    1,2\r\n    3,4\r\n  </object-multiArray>\r\n  <complexArray>\r\n    <m a=\"1\" b=\"1,2\" />\r\n    <m a=\"3\" b=\"3,4\" />\r\n  </complexArray>\r\n</widget>\r\n`````\r\n\r\nYou can also look at the [demo xml](https://raw.githubusercontent.com/yaronn/wopr/master/examples/sample.xml) to get more samples.\r\n\r\n![](./examples/images/map.png \"term\")\r\n\r\n##Viewing Reports##\r\n\r\n\r\nDepending on how you use a report, you have a few ways to view it. On Windows you will probably only be able to use the third option and need to [install the fonts](http://webservices20.blogspot.com/2015/04/running-terminal-dashboards-on-windows.html) for best view.\r\n\r\n**Option 1: POST it to the wopr online viewer**\r\n\r\n`````bash\r\n$> curl --data '<document><page><item col=\"0\" row=\"0\" colSpan=\"5\" rowSpan=\"4\"><bar maxHeight=\"5\" data-titles=\"A,B,C\" data-data=\"2,5,3\" /></item></page></document>' tty.zone\\?cols=$((COLUMNS))\r\n`````\r\n\r\nIf you experience firewall issues replace tty.zone with ec2-23-21-64-152.compute-1.amazonaws.com.\r\n\r\n**Option 2: POST it from external url**\r\n\r\nSave the report content in some url (e.g. gist) and then:\r\n\r\n`````bash\r\n$> a=$(curl -s https://gist.githubusercontent.com/yaronn/e6eec6d0e7adac63c83f/raw/50aca544d26a32aa189e790635c8679067017948/gistfile1.xml); curl --data \"$a\" tty.zone\\?cols=$((COLUMNS))\r\n`````\r\n\r\n(note you need the gist raw url)\r\n\r\nIf you experience firewall issues replace tty.zone with ec2-23-21-64-152.compute-1.amazonaws.com.\r\n\r\nTip: If you use a url shortener (e.g. bit.ly) add the -L flag to curl to follow redirects.\r\n\r\n**Option 3: via the local viewer**\r\n\r\nSave the report xml to report.xml and then:\r\n\r\n`````bash\r\n$> npm install -g wopr\r\n$> wopr report.xml\r\n`````\r\n\r\nNote the local viewer does not send anything online and does not require network.\r\n\r\n**Tip:** Maximize the terminal before viewing the report for best viewing experience  \r\n**Tip:** If you <kbd>CTRL+C</kbd> in the middle or rendering your cursoe might disappear. Restore it by running again and letting the render complete or with `$> echo '\\033[?25h'`\r\n\r\n**View customization**\r\nWhen using the online reports, you might need to adjust the slides size based on your font / resolution or use non-xterm terminal. tty.zone supports the following query params:\r\n\r\n`````bash\r\ncurl -N tty.zone\\?\\&cols=200\\&rows=50\\&terminal=xterm\r\n`````\r\n\r\nYou can infer them automatically from your environment:\r\n\r\n`````bash\r\ncurl -N tty.zone\\?\\&cols=$((COLUMNS))\\&rows=$((LINES-5))\\&terminal=${TERM}\r\n`````\r\n\r\nIt is best to escape all special characters (e.g. ? &) as seen in the above samples, since some shells will require this (zsh).\r\n\r\n\r\n**Pages**\r\n\r\nWhen viewing a report with the local viewer you can advance slides with the Return or Space keys.\r\nWhen using the online viewer you have 2 options:\r\n\r\n**Option 1:** Manually advance slides with Return or Space:\r\n\r\n`````bash\r\np=0; while true; do curl tty.zone/$((p++))\\?cols=$((COLUMNS)); read; done\r\n`````\r\n\r\n**Option 2:** Slides advance automatically every 5 seconds:\r\n\r\n`````bash\r\ncurl -N tty.zone/\\[0-2\\]\\?auto\\&cols=$((COLUMNS))\r\n`````\r\n\r\nWhere 0 is the index of the first slide and 2 of the last slide. Keep the brackets in the url (they are not to express optional argument) and escape them as in the above sample.\r\n\r\nTip: disable curl buffering with the -N flag\r\n\r\nYou can also view a specific slide (#4 in this case):\r\n\r\n`````bash\r\ncurl --data '<document>...</document>' tty.zone/4\\?cols=$((COLUMNS))\r\n`````\r\n\r\n##License##\r\nMIT\r\n\r\n\r\n## More Information\r\nCreated by Yaron Naveh ([twitter](http://twitter.com/YaronNaveh), [blog](http://webservices20.blogspot.com/))\r\n","versions":{"0.0.1":{"name":"wopr","version":"0.0.1","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/yaronn/wopr.git"},"author":{"name":"Yaron Naveh","url":"yaronn01@gmail.com"},"bin":{"wopr":"./bin/presenter-cli.js"},"license":"ISC","dependencies":{"blessed":"^0.1.7","blessed-contrib":"^2.3.1","xml2js":"^0.4.9"},"homepage":"https://github.com/yaronn/wopr","directories":{"test":"test"},"devDependencies":{},"description":"","gitHead":"8fb30f022f8e61e9f21c0051a62bb9caa2772677","bugs":{"url":"https://github.com/yaronn/wopr/issues"},"_id":"wopr@0.0.1","_shasum":"5b2c712a4b30ca284e4af0ee7d15d8cb54ece39b","_from":".","_npmVersion":"2.11.2","_nodeVersion":"0.12.6","_npmUser":{"name":"yaron","email":"yaronn01@gmail.com"},"dist":{"shasum":"5b2c712a4b30ca284e4af0ee7d15d8cb54ece39b","tarball":"https://registry.npmjs.org/wopr/-/wopr-0.0.1.tgz","integrity":"sha512-gu3LT1NqW2J0D4fsVIepIWTiCgR1UBiLpsaLq5C0LPX6ApI6/EaZ1kM8zbdvdninmhqpaL53FrIoUIOEAFtD8g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFfqKTUceJe4JVEPD6hF8nmrJy8HQV+R3klFrDXkkF60AiEA2siGlPHureSiTUw3w+JXTC/QpwExa+ypQVA5k6c2tVI="}]},"maintainers":[{"name":"yaron","email":"yaronn01@gmail.com"}]},"0.0.2":{"name":"wopr","version":"0.0.2","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/yaronn/wopr.git"},"author":{"name":"Yaron Naveh","url":"yaronn01@gmail.com"},"bin":{"wopr":"./bin/presenter-cli.js"},"license":"ISC","dependencies":{"blessed":"^0.1.7","blessed-contrib":"^2.3.1","xml2js":"^0.4.9"},"homepage":"https://github.com/yaronn/wopr","directories":{"test":"test"},"devDependencies":{},"description":"","gitHead":"48574de7b8aa3020e4b023b9e4b999f5f6b0e66e","bugs":{"url":"https://github.com/yaronn/wopr/issues"},"_id":"wopr@0.0.2","_shasum":"beff218874744158805769415bfd0319a93542b6","_from":".","_npmVersion":"2.11.2","_nodeVersion":"0.12.6","_npmUser":{"name":"yaron","email":"yaronn01@gmail.com"},"dist":{"shasum":"beff218874744158805769415bfd0319a93542b6","tarball":"https://registry.npmjs.org/wopr/-/wopr-0.0.2.tgz","integrity":"sha512-xk6FMhLJjMRXZZ9CRtIxOMDPum62JUtq4/3ZG2Wrzvg2Ptd9XxqrTQ3Jr7On0AZ5PJrkXjzzVZ4dkeIQ+l0IbQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCgAV02w/Xlmpn2sWbkn1UBE/TGtkkrn62IEXVpuPcJrQIhAOaFF642o+M/AM/Rb+WIwgNAnEY0qRttTE/dwrtH7wVP"}]},"maintainers":[{"name":"yaron","email":"yaronn01@gmail.com"}]},"0.0.3":{"name":"wopr","version":"0.0.3","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/yaronn/wopr.git"},"author":{"name":"Yaron Naveh","url":"yaronn01@gmail.com"},"bin":{"wopr":"./bin/presenter-cli.js"},"license":"ISC","dependencies":{"blessed":"^0.1.7","blessed-contrib":"^2.3.1","xml2js":"^0.4.9"},"homepage":"https://github.com/yaronn/wopr","directories":{"test":"test"},"devDependencies":{},"description":"WOPR is a simple markup language for creating rich terminal reports, presentations and infographics.","gitHead":"7b41fb509e46be610f2736e2d11e8da707f3b47f","bugs":{"url":"https://github.com/yaronn/wopr/issues"},"_id":"wopr@0.0.3","_shasum":"212779e69ad917020bdb00cf6069967dd05ca210","_from":".","_npmVersion":"2.11.2","_nodeVersion":"0.12.6","_npmUser":{"name":"yaron","email":"yaronn01@gmail.com"},"dist":{"shasum":"212779e69ad917020bdb00cf6069967dd05ca210","tarball":"https://registry.npmjs.org/wopr/-/wopr-0.0.3.tgz","integrity":"sha512-E5brS0tw3+ZuesXqGnZix3lsibfBn9qBrCs/RQrySwFNM17Af7HBPQ9usYXK05FPtBNyqT4ZzRGkrDHes/nZIw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE0U5PrSJyyw2pMZHfq99xS0y+3MX5FbbIChDNzndfyvAiEA9csWd1J158VhFZz6etomq96TmA4+M8RlHqdEUCkfB1A="}]},"maintainers":[{"name":"yaron","email":"yaronn01@gmail.com"}]},"0.0.4":{"name":"wopr","version":"0.0.4","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/yaronn/wopr.git"},"author":{"name":"Yaron Naveh","url":"yaronn01@gmail.com"},"bin":{"wopr":"./bin/presenter-cli.js"},"license":"ISC","dependencies":{"blessed":"^0.1.7","blessed-contrib":"^2.3.1","xml2js":"^0.4.9"},"homepage":"https://github.com/yaronn/wopr","directories":{"test":"test"},"devDependencies":{},"description":"WOPR is a simple markup language for creating [rich terminal reports](https://github.com/yaronn/blessed-contrib), presentations and infographics.","gitHead":"3bff636069512851fcded2bd70cb940f428b98a7","bugs":{"url":"https://github.com/yaronn/wopr/issues"},"_id":"wopr@0.0.4","_shasum":"8c9efb1f5990038ca124b4ddfc24045c060fa2e6","_from":".","_npmVersion":"3.7.3","_nodeVersion":"5.9.0","_npmUser":{"name":"yaron","email":"yaronn01@gmail.com"},"dist":{"shasum":"8c9efb1f5990038ca124b4ddfc24045c060fa2e6","tarball":"https://registry.npmjs.org/wopr/-/wopr-0.0.4.tgz","integrity":"sha512-1EqXuVslHfOdeyyzwRxGoiJrrc4pS+rEAMwN8kRlLFyPlJ7YxDe80sx7TTb7IPCPHpSRWulCVtdOKPeeyqAFDA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHJK6CwZxWBwb/QHIw3xkPs5bVokv7+34BAxxRDPH279AiEAxFlSgpjRt+wwNsIkhUBemXs40Jh2ZXYM/enUMWJXfQU="}]},"maintainers":[{"name":"yaron","email":"yaronn01@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/wopr-0.0.4.tgz_1459532427189_0.5709376623854041"}},"0.0.5":{"name":"wopr","version":"0.0.5","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/yaronn/wopr.git"},"author":{"name":"Yaron Naveh","url":"yaronn01@gmail.com"},"bin":{"wopr":"./bin/presenter-cli.js"},"license":"ISC","dependencies":{"blessed":"0.1.11","blessed-contrib":"2.3.1","xml2js":"^0.4.9"},"homepage":"https://github.com/yaronn/wopr","directories":{"test":"test"},"devDependencies":{},"description":"WOPR is a simple markup language for creating [rich terminal reports](https://github.com/yaronn/blessed-contrib), presentations and infographics.","gitHead":"4cac0914baa82a8b7beb39a4be3292d6b5be6756","bugs":{"url":"https://github.com/yaronn/wopr/issues"},"_id":"wopr@0.0.5","_shasum":"7a5808b235a216131bc723fd5ef85df35729701f","_from":".","_npmVersion":"3.7.3","_nodeVersion":"5.9.0","_npmUser":{"name":"yaron","email":"yaronn01@gmail.com"},"dist":{"shasum":"7a5808b235a216131bc723fd5ef85df35729701f","tarball":"https://registry.npmjs.org/wopr/-/wopr-0.0.5.tgz","integrity":"sha512-EtO8OOkaYQnvB5K939SHJakPsSmDCWML13PPDdIuBdqV5BMkKJiQ2HegU8NAOoJcsd01xP4EIi4A1db9AasYrg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHH7nd99gFP+Y5Xf2Rq50mhudH/fAtPHzxSKIzT8s7mfAiEA7eZkGkwZUX0KRBmmu07tKcWXA4NhWPID55qGSrHXOzg="}]},"maintainers":[{"name":"yaron","email":"yaronn01@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/wopr-0.0.5.tgz_1459532912212_0.6474601270165294"}}},"homepage":"https://github.com/yaronn/wopr","repository":{"type":"git","url":"git+https://github.com/yaronn/wopr.git"},"author":{"name":"Yaron Naveh","url":"yaronn01@gmail.com"},"bugs":{"url":"https://github.com/yaronn/wopr/issues"},"license":"ISC","readmeFilename":"README.md","description":"WOPR is a simple markup language for creating [rich terminal reports](https://github.com/yaronn/blessed-contrib), presentations and infographics.","users":{"nelix":true,"scottfreecode":true}}