-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
35 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,27 @@ | ||
#!/usr/bin/env node | ||
var chalk = require('chalk'); | ||
var info = require('../lib'); | ||
var meow = require('meow'); | ||
|
||
var scripts = info(); | ||
|
||
for ( var script in scripts ) { | ||
var description = scripts[script]; | ||
var cli = meow([ | ||
'Usage', | ||
' npm-scripts-info [hr]', | ||
'', | ||
'Options', | ||
' --help, -h Display usage', | ||
' --reporter, -r Specify the custom reporter to be used', | ||
'', | ||
'Examples', | ||
' npm-scripts-info -r=my-reporter' | ||
].join('\n'), { | ||
string: ['reporter'], | ||
alias: { | ||
reporter: 'r', | ||
help: 'h' | ||
} | ||
}); | ||
|
||
console.log(chalk.blue(script) + ':'); | ||
console.log(' ' + chalk.green(description)); | ||
} | ||
cli.flags.reporter | ||
? require('npm-scripts-info-' + cli.flags.reporter)(scripts) | ||
: require('../lib/reporter')(scripts); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
var chalk = require('chalk'); | ||
|
||
function reporter(scripts) { | ||
for ( var script in scripts ) { | ||
var description = scripts[script]; | ||
|
||
console.log(chalk.blue(script) + ':'); | ||
console.log(' ' + chalk.green(description)); | ||
} | ||
} | ||
|
||
module.exports = reporter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
"rewire": "^2.5.1" | ||
}, | ||
"dependencies": { | ||
"chalk": "^1.1.1" | ||
"chalk": "^1.1.1", | ||
"meow": "^3.7.0" | ||
} | ||
} |