Skip to content

Commit cd14c1e

Browse files
committed
Added doc URL to all invalid arg errors
1 parent 2fe8fef commit cd14c1e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

scss-to-css/src/cli.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env node
22

3+
const docURL = 'https://github.com/adamlui/js-utils/tree/main/scss-to-css#-command-line-usage';
4+
35
// Import LIBS
46
const fs = require('fs'),
57
path = require('path'),
@@ -31,7 +33,7 @@ process.argv.forEach(arg => {
3133
console.error(`\n${br}ERROR: Arg [${ arg }] not recognized.${nc}`);
3234
console.info(`\n${by}Valid arguments are below.${nc}`);
3335
printHelpSections(['configOptions', 'infoCmds']);
34-
process.exit(1);
36+
printHelpCmdAndDocURL(); process.exit(1);
3537
}});
3638

3739
// Show HELP screen if -h or --help passed
@@ -55,9 +57,8 @@ else { // run MAIN routine
5557
if (inputArg && !fs.existsSync(inputPath)) {
5658
console.error(`\n${br}Error: First argument can only be an existing file or directory.`
5759
+ `\n'${ inputPath }' does not exist.${nc}`
58-
+ `\n\n${bg}Example valid command: \n» scss-to-css . output.min.css${nc}`
59-
+ `\n\n${by}For all command options: \n» scss-to-css --help${nc}`);
60-
process.exit(1);
60+
+ `\n\n${bg}Example valid command: \n» scss-to-css . output.min.css${nc}`);
61+
printHelpCmdAndDocURL(); process.exit(1);
6162
}
6263

6364
// Find all eligible JavaScript files or arg-passed file
@@ -177,4 +178,7 @@ function printHelpSections(includeSections = ['cmdFormat', 'pathArgs', 'configOp
177178
}
178179
}
179180

181+
function printHelpCmdAndDocURL() {
182+
console.info(`\n${by}For more help, type 'scss-to-css --help' or visit\n${docURL + nc}`); }
183+
180184
function printIfNotQuiet(msg) { if (!config.quietMode) console.info(msg); }

0 commit comments

Comments
 (0)