Comparing version 2.4.1 to 2.4.2
10
cli.js
@@ -21,2 +21,3 @@ #!/usr/bin/env node | ||
d: 'duration', | ||
D: 'debug', | ||
s: 'speed' | ||
@@ -45,2 +46,3 @@ } | ||
--version, -v: Print version and exit | ||
--debug, -D: Display error messages, if any (default: false) | ||
--help, -h: Show this message | ||
@@ -76,3 +78,3 @@ | ||
lolcatjs.println('lolcatjs ' + info.version + ' (c) 2015 Robert Marsal'); | ||
lolcatjs.println('lolcatjs ' + info.version + ' (c) 2015-2023 Robert Marsal'); | ||
@@ -121,2 +123,8 @@ process.exit(); | ||
if (args.debug) { | ||
lolcatjs.options.debug = Boolean(args.debug); | ||
} | ||
lolcatjs.init(); | ||
if (args._.length === 0) { | ||
@@ -123,0 +131,0 @@ |
27
index.js
@@ -7,11 +7,4 @@ "use strict"; | ||
// sleep will be loaded by the init function (if available) | ||
let sleep = null; | ||
// Because sleep is a native module, depending on the | ||
// platform of the user, the compilation might fail, | ||
// in this case fallback, and show no animations. | ||
try { | ||
sleep = require('sleep'); | ||
} catch (error) { | ||
console.error('Unable to load the sleep module (no animations available)'); | ||
} | ||
@@ -31,2 +24,4 @@ const options = { | ||
freq: 0.3, | ||
// Whether to display error messages or not | ||
debug: false, | ||
}; | ||
@@ -137,2 +132,17 @@ | ||
const init = function() { | ||
// Because sleep is a native module, depending on the | ||
// platform of the user, the compilation might fail, | ||
// in this case fallback, and show no animations. | ||
try { | ||
sleep = require('sleep'); | ||
} catch (error) { | ||
if (options.debug) { | ||
console.error('The sleep module is not available, animations will be disabled.', error); | ||
} | ||
} | ||
return null; | ||
} | ||
exports.options = options; | ||
@@ -144,1 +154,2 @@ exports.println = println; | ||
exports.fromString = fromString; | ||
exports.init = init; |
{ | ||
"name": "lolcatjs", | ||
"version": "2.4.1", | ||
"version": "2.4.2", | ||
"description": "The rainbow I tastes it", | ||
@@ -38,3 +38,3 @@ "main": "index.js", | ||
"optionalDependencies": { | ||
"sleep": "^6.1.0" | ||
"sleep": "^6.3.0" | ||
}, | ||
@@ -41,0 +41,0 @@ "engines": { |
@@ -49,3 +49,3 @@ ![lolcatjs](/assets/banner.png) | ||
## Screenshot | ||
![lolcatjs](/assets/screenshot.png) | ||
![lolcatjs](/assets/screenshot-v2.png) | ||
@@ -52,0 +52,0 @@ ## Thanks |
9862
231