-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.js
More file actions
39 lines (26 loc) · 812 Bytes
/
cli.js
File metadata and controls
39 lines (26 loc) · 812 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env node
'use strict'
const meow = require('meow')
const pckg = require('./package.json')
const get_kloc = require('./')
const cli = meow(`
${pckg.name}-v${pckg.version}
Usage:
$ kloc <project_path>
Options
--exclude Files & dirs to exclude (supports nested path)
--show-logs Include logs in the output
Usage
$ kloc ~/code/my-app
$ kloc ~/code/my-app --exclude .git,node_modules,dist --show-logs
`)
if (cli.input.length > 0 && cli.input[0] !== '') {
const project_path = cli.input[0]
const { exclude, showLogs } = cli.flags
get_kloc(project_path, { exclude, show_logs: showLogs })
.then(kloc => console.log(`\nKLOC: ${kloc}`))
.catch(err => console.error(err.message))
} else {
console.log(cli.help)
process.exit(1)
}