Skip to content

Commit

Permalink
refactor: help method to fix lint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
erisu committed Dec 17, 2021
1 parent 4e86379 commit b9cb7a1
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions src/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,20 @@ const cordova_lib = require('cordova-lib');
const path = require('path');

module.exports = function help (args) {
let command,
file,
raw,
docdir;
args = args || [];
command = ((args)[0] || 'cordova');
docdir = path.join(__dirname, '..', 'doc');
file = [
command + '.md',
command + '.txt',

const command = ((args)[0] || 'cordova');
const docdir = path.join(__dirname, '..', 'doc');
const file = [
`${command}.md`,
`${command}.txt`,
'cordova.md',
'cordova.txt'
].map(function (file) {
const f = path.join(docdir, file);
if (fs.existsSync(f)) {
return f;
}
}).filter(function (f) {
return !!f;
});
raw = fs.readFileSync(file[0]).toString('utf8').replace(/cordova-cli/g, cordova_lib.binname);
]
.map(f => path.join(docdir, f))
.filter(f => !!fs.existsSync(f));

const raw = fs.readFileSync(file[0]).toString('utf8').replace(/cordova-cli/g, cordova_lib.binname);
// cordova.emit('results', raw);

return raw;
Expand Down

0 comments on commit b9cb7a1

Please sign in to comment.