Skip to content

Commit

Permalink
Merge 0214d89 into 2da65b6
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesHagerman committed Apr 23, 2020
2 parents 2da65b6 + 0214d89 commit 36759af
Show file tree
Hide file tree
Showing 8 changed files with 827 additions and 292 deletions.
21 changes: 10 additions & 11 deletions src/app/command-processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -704,16 +704,6 @@ function unknownParametersError(params){
);
}

const errors = {
unknownCommandError,
unknownArgumentError,
requiredParameterError,
variadicParameterRequiredError,
variadicParameterPositionError,
requiredParameterPositionError,
unknownParametersError
};

function showHelp(cb){
Yargs.showHelp(cb);
}
Expand All @@ -725,7 +715,16 @@ module.exports = {
createAppCategory,
createErrorHandler,
showHelp,
errors,
errors: {
usageError,
unknownCommandError,
unknownArgumentError,
requiredParameterError,
variadicParameterRequiredError,
variadicParameterPositionError,
requiredParameterPositionError,
unknownParametersError
},
test: {
consoleErrorLogger
}
Expand Down
17 changes: 10 additions & 7 deletions src/cli/keys.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ module.exports = ({ commandProcessor, root }) => {
options: protocolOption,
handler: (args) => {
const KeysCommand = require('../cmd/keys');
return new KeysCommand().makeNewKey(args.params.filename, args);
return new KeysCommand().makeNewKey(args);
}
});

commandProcessor.createCommand(keys, 'load', 'Load a key saved in a file onto your device', {
params: '<filename>',
handler: (args) => {
const KeysCommand = require('../cmd/keys');
return new KeysCommand().writeKeyToDevice(args.params.filename);
return new KeysCommand().writeKeyToDevice(args);
}
});

Expand All @@ -35,7 +35,7 @@ module.exports = ({ commandProcessor, root }) => {
},
handler: (args) => {
const KeysCommand = require('../cmd/keys');
return new KeysCommand().saveKeyFromDevice(args.params.filename, args);
return new KeysCommand().saveKeyFromDevice(args);
}
});

Expand All @@ -49,7 +49,7 @@ module.exports = ({ commandProcessor, root }) => {
},
handler: (args) => {
const KeysCommand = require('../cmd/keys');
return new KeysCommand().sendPublicKeyToServer(args.params.deviceID, args.params.filename, args);
return new KeysCommand().sendPublicKeyToServer(args);
}
});

Expand All @@ -58,25 +58,28 @@ module.exports = ({ commandProcessor, root }) => {
options: protocolOption,
handler: (args) => {
const KeysCommand = require('../cmd/keys');
return new KeysCommand().keyDoctor(args.params.deviceID, args);
return new KeysCommand().keyDoctor(args);
}
});

commandProcessor.createCommand(keys, 'server', 'Switch server public keys.', {
epilogue: 'Defaults to the Particle public cloud or you can provide another key in DER format and the server hostname or IP and port',
params: '[filename]',
params: '[filename] [outputFilename]',
options: Object.assign({}, protocolOption, {
'host': {
description: 'Hostname or IP address of the server to add to the key'
},
'port': {
number: true,
description: 'Port number of the server to add to the key'
},
'deviceType': {
description: 'Generate key file for the provided device type'
}
}),
handler: (args) => {
const KeysCommand = require('../cmd/keys');
return new KeysCommand().writeServerPublicKey(args.params.filename, args);
return new KeysCommand().writeServerPublicKey(args);
}
});

Expand Down

0 comments on commit 36759af

Please sign in to comment.