Skip to content

Commit

Permalink
Minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
perrin4869 committed Nov 30, 2021
1 parent f1a0c18 commit da10f49
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
2 changes: 1 addition & 1 deletion lib/command-line-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const optionDefinitions = (defaults = {}) => [

export default (argv, defaults) => {
const { cmd, _unknown: unknown } = commandLineArgs(commandDefinitions, { stopAtFirstUnknown: true, argv });
const { command, definitions, constants } = parse(cmd, defaults);
const { command, definitions = [], constants = {} } = parse(cmd, defaults);

const args = commandLineArgs([...definitions, ...optionDefinitions(defaults)], { argv: unknown });
if (args.ssl === null && defaults.ssl === undefined) { // If no value is handed, treat it as boolean
Expand Down
4 changes: 0 additions & 4 deletions lib/commands/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@ export default (command, defaults = {}) => {
if (command === 'max') {
return {
command: migrate,
definitions: [],
constants: { to: 'max' },
};
}

if (isPositiveInteger(command)) {
return {
command: migrate,
definitions: [],
constants: { to: parseInt(command, 10) },
};
}
Expand All @@ -30,13 +28,11 @@ export default (command, defaults = {}) => {
if (command === COMMAND_DROP_SCHEMA) {
return {
command: dropSchema,
definitions: [],
};
}

return {
command: () => Promise.reject(new Error('Invalid command.')),
definitions: [],
};
};

Expand Down

0 comments on commit da10f49

Please sign in to comment.