Last change
on this file since b738035 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
662 bytes
|
Line | |
---|
1 | #!/usr/bin/env node
|
---|
2 |
|
---|
3 | const dirs = []
|
---|
4 | let doSort = false
|
---|
5 | process.argv.slice(2).forEach(arg => {
|
---|
6 | if (arg === '-h' || arg === '--help') {
|
---|
7 | console.log('usage: npm-packlist [-s --sort] [directory, directory, ...]')
|
---|
8 | process.exit(0)
|
---|
9 | } else if (arg === '-s' || arg === '--sort')
|
---|
10 | doSort = true
|
---|
11 | else
|
---|
12 | dirs.push(arg)
|
---|
13 | })
|
---|
14 |
|
---|
15 | const sort = list => doSort ? list.sort((a, b) => a.localeCompare(b, 'en')) : list
|
---|
16 |
|
---|
17 | const packlist = require('../')
|
---|
18 | if (!dirs.length)
|
---|
19 | console.log(sort(packlist.sync({ path: process.cwd() })).join('\n'))
|
---|
20 | else {
|
---|
21 | dirs.forEach(path => {
|
---|
22 | console.log(`> ${path}`)
|
---|
23 | console.log(sort(packlist.sync({ path })).join('\n'))
|
---|
24 | })
|
---|
25 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.