Skip to content

Commit

Permalink
fix: add let/const to variables
Browse files Browse the repository at this point in the history
  • Loading branch information
wdavidw committed Feb 21, 2022
1 parent 5b116c7 commit dd175ff
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
14 changes: 7 additions & 7 deletions packages/shell/lib/plugins/args.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ Shell.prototype.parse = function(argv = process, options = {}) {
// Check against required main
const main = config.main;
if (main) {
required = typeof main.required === 'function' ? !!main.required.call(null, {
const required = typeof main.required === 'function' ? !!main.required.call(null, {
config: config,
command: command
}) : !!main.required;
Expand Down Expand Up @@ -200,8 +200,8 @@ Shell.prototype.parse = function(argv = process, options = {}) {
params[appconfig.command] = [];
}
for (const command_params of full_params) {
for (k in command_params) {
v = command_params[k];
for (const k in command_params) {
const v = command_params[k];
if (k === appconfig.command) {
params[k].push(v);
} else {
Expand Down Expand Up @@ -286,9 +286,9 @@ Shell.prototype.compile = function(data, options = {}) {
}
}
if (config.main) {
value = ldata[config.main.name];
const value = ldata[config.main.name];
// Handle required
required = typeof config.main.required === 'function' ? !!config.main.required.call(null, {
const required = typeof config.main.required === 'function' ? !!config.main.required.call(null, {
config: config,
command: undefined
}) : !!config.main.required;
Expand Down Expand Up @@ -319,8 +319,8 @@ Shell.prototype.compile = function(data, options = {}) {
// Handle data not defined in the configuration
// Note, they are always pushed to the end and associated with the deepest child
const results = [];
for (key in ldata) {
value = ldata[key];
for (const key in ldata) {
const value = ldata[key];
if (keys[key]) {
continue;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/shell/lib/plugins/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,12 @@ Shell.prototype.confx = function(command = []) {
if (command.length) {
config.command = command;
}
for (name in config.commands) {
for (const name in config.commands) {
config.commands[name] = ctx.confx([...command, name]).get();
}
config.options = this.options.show();
config.shortcuts = {};
for (name in config.options) {
for (const name in config.options) {
const option = config.options[name];
if (option.shortcut) {
config.shortcuts[option.shortcut] = option.name;
Expand Down
8 changes: 4 additions & 4 deletions packages/shell/lib/plugins/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ Shell.prototype.help = function(commands = [], options = {}) {
}
for (const name of Object.keys(config.options).sort()) {
const option = config.options[name];
description = option.description || `No description yet for the ${option.name} option.`;
let description = option.description || `No description yet for the ${option.name} option.`;
if (option.required) {
description += ' Required.';
}
Expand Down Expand Up @@ -323,7 +323,7 @@ Shell.prototype.help = function(commands = [], options = {}) {
// Detailed command information
if (options.extended) {
for (const name in config.commands) {
command = config.commands[name];
const command = config.commands[name];
content.push('');
content.push(`COMMAND \"${command.name}\"`);
// Raw command, no main, no child commands
Expand Down Expand Up @@ -384,7 +384,7 @@ Shell.prototype.help = function(commands = [], options = {}) {
return `${options.indent}${l}`;
}));
} else {
line = pad(`${options.indent}${cmd} --help`, options.columns);
let line = pad(`${options.indent}${cmd} --help`, options.columns);
if (line.length > options.columns) {
content.push(line);
line = ' '.repeat(options.columns);
Expand All @@ -399,7 +399,7 @@ Shell.prototype.help = function(commands = [], options = {}) {
return `${options.indent}${l}`;
}));
} else {
line = pad(`${options.indent}${cmd} help`, options.columns);
let line = pad(`${options.indent}${cmd} help`, options.columns);
if (line.length > options.columns) {
content.push(line);
line = ' '.repeat(options.columns);
Expand Down

0 comments on commit dd175ff

Please sign in to comment.