Skip to content

Commit 82b2f8d

Browse files
committed
executable 🔧
1 parent 95d0ddf commit 82b2f8d

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

bin.js

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env node
2+
'use strict'
3+
4+
const yargs = require('yargs')
5+
const game = require('.')
6+
7+
8+
9+
const argv = yargs.argv
10+
11+
if (argv.help || argv.h) {
12+
process.stdout.write(`
13+
Usage:
14+
minesweeper [--size <value>]
15+
16+
Examples:
17+
minesweeper
18+
minesweeper --size 15
19+
\n`)
20+
process.exit()
21+
}
22+
23+
const size = +argv.size || 20
24+
25+
game({size})
26+
.on('abort', () => process.exit(1))

package.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"description": "Play Minesweeper in the command line!",
44
"version": "0.1.0",
55
"main": "index.js",
6-
"files": ["index.js"],
6+
"bin": {"minesweeper": "bin.js"},
7+
"files": ["index.js", "minesweeper.js"],
78
"keywords": ["command", "line", "cli", "minesweeper"],
89
"author": "Jannis R <mail@jannisr.de>",
910
"homepage": "https://github.com/derhuerst/cli-minesweeper",
@@ -14,6 +15,7 @@
1415
"dependencies": {
1516
"ansi-escapes": "^1.4",
1617
"chalk": "^1.1.3",
17-
"prompt-skeleton": "^0.1.1"
18+
"prompt-skeleton": "^0.1.1",
19+
"yargs": "^6.4"
1820
}
1921
}

0 commit comments

Comments
 (0)