Skip to content

Commit c812c19

Browse files
committed
fix #1 - show help
1 parent 1be62b7 commit c812c19

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

bin/presenter-cli.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#! /usr/bin/env node
22

3+
var file = process.argv[2]
4+
if (file=="-h" | file=="--help") {
5+
showHelp()
6+
process.exit()
7+
}
8+
39
var fs = require('fs')
410
, parse = require('xml2js').parseString
511
, Viewer = require('../lib/document-viewer.js')
@@ -9,7 +15,6 @@ var fs = require('fs')
915
var page = -1
1016
var viewer = null
1117

12-
var file = process.argv[2]
1318
if (!file) throw "please specify the presentation to render: \r\n\r\n $> doc-viewer doc.xml \r\n\r\n "
1419

1520
var xml = fs.readFileSync(file)
@@ -31,7 +36,7 @@ parse(xml, function (err, doc) {
3136
prev()
3237
});
3338

34-
screen.key(['q'], function(ch, key) {
39+
screen.key(['q', 'escape'], function(ch, key) {
3540
process.exit()
3641
});
3742

@@ -55,3 +60,6 @@ function show() {
5560
if (err!==null) console.log(err)
5661
}
5762

63+
function showHelp() {
64+
console.log("\r\nusage: $> wopr [file.xml] \r\n\r\nuse spacebar / return to go forward in the presentation, backspace to go back, and ESC or q or CTRL+C to exit.\r\n\r\nhttps://github.com/yaronn/wopr\r\n\r\n")
65+
}

0 commit comments

Comments
 (0)