mirror of
https://github.com/remy/inliner.git
synced 2024-09-11 17:25:30 +03:00
feat: auto-update + help
This commit is contained in:
parent
ef60842815
commit
e046c3739a
27
cli/index.js
27
cli/index.js
@ -31,32 +31,25 @@ if (argv.debug) {
|
||||
require('debug').enable('inliner');
|
||||
}
|
||||
|
||||
var Inliner = require('../');
|
||||
|
||||
// checks for available update and returns an instance
|
||||
// var updateNotifier = require('update-notifier');
|
||||
// var pkg = require('../package.json');
|
||||
// var notifier = updateNotifier({ pkg: pkg });
|
||||
// if (notifier.update) {
|
||||
// // notify using the built-in convenience method
|
||||
// notifier.notify();
|
||||
// }
|
||||
var updateNotifier = require('update-notifier');
|
||||
var pkg = require(__dirname + '/../package.json');
|
||||
var notifier = updateNotifier({ pkg: pkg });
|
||||
if (notifier.update) {
|
||||
// notify using the built-in convenience method
|
||||
notifier.notify();
|
||||
}
|
||||
|
||||
var Inliner = require('../');
|
||||
var url = argv._.shift();
|
||||
|
||||
var argvKeys = Object.keys(argv).filter(function (item) {
|
||||
var argvKeys = Object.keys(argv).filter(function filter(item) {
|
||||
return item !== '_';
|
||||
});
|
||||
|
||||
if (!url && argvKeys.length === 0 || argv.help) {
|
||||
// show USAGE!
|
||||
console.log(' Examples:');
|
||||
console.log('');
|
||||
console.log(' $ inliner -v http://twitter.com > twitter.html');
|
||||
console.log(' $ inliner -ni http://twitter.com > twitter.html');
|
||||
console.log('');
|
||||
console.log(' For more details see http://github.com/remy/inliner/');
|
||||
console.log('');
|
||||
console.log(require('fs').readFileSync(__dirname + '/../docs/usage.txt', 'utf8'));
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
|
19
docs/usage.txt
Normal file
19
docs/usage.txt
Normal file
@ -0,0 +1,19 @@
|
||||
|
||||
Usage:
|
||||
|
||||
$ inliner [options] url-or-filename
|
||||
|
||||
Options:
|
||||
|
||||
-h, --help output usage information
|
||||
-V, --version output the version number
|
||||
-v, --verbose echo on STDERR the progress of inlining
|
||||
-n, --nocompress don't compress CSS or HTML - useful for debugging
|
||||
-i, --images don't encode images - keeps files size small, but more requests
|
||||
|
||||
Examples:
|
||||
|
||||
$ inliner -v https://twitter.com > twitter.html
|
||||
$ inliner -ni local-file.html > local-file.min.html
|
||||
|
||||
For more details see http://github.com/remy/inliner/
|
Loading…
Reference in New Issue
Block a user