Skip to content

Commit

Permalink
Merge 7aa0e04 into 4222580
Browse files Browse the repository at this point in the history
  • Loading branch information
busticated committed Apr 9, 2020
2 parents 4222580 + 7aa0e04 commit 4c5df70
Show file tree
Hide file tree
Showing 47 changed files with 4,312 additions and 1,131 deletions.
104 changes: 7 additions & 97 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,15 @@
"cli-spinner": "^0.2.10",
"cli-table": "^0.3.1",
"core-js": "^3.4.7",
"fs-extra": "^8.1.0",
"glob": "^7.1.6",
"handlebars": "^4.1.2",
"inquirer": "^6.5.2",
"latest-version": "^2.0.0",
"lodash": "^4.17.15",
"moment": "^2.24.0",
"node-wifiscanner2": "^1.2.0",
"particle-api-js": "^8.0.1",
"particle-api-js": "^8.3.0",
"particle-commands": "0.3.0",
"particle-library-manager": "^0.1.14",
"request": "https://github.com/particle-iot/request/releases/download/v2.75.1-relativepath.1/request-2.75.1-relativepath.1.tgz",
Expand Down Expand Up @@ -92,7 +93,6 @@
"eslint": "^5.16.0",
"eslint-config-particle": "^2.2.1",
"execa": "^2.0.4",
"fs-extra": "^8.1.0",
"github-api": "^3.3.0",
"mocha": "^6.2.2",
"mock-fs": "^4.10.4",
Expand Down
1 change: 1 addition & 0 deletions src/app/command-processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,7 @@ function unknownParametersError(params){
}

const errors = {
usageError,
unknownCommandError,
unknownArgumentError,
requiredParameterError,
Expand Down
46 changes: 28 additions & 18 deletions src/cli/cloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@ module.exports = ({ commandProcessor, root }) => {
}
};

commandProcessor.createCommand(cloud, 'claim', 'Register a device with your user account with the cloud', {
params: '<deviceID>',
commandProcessor.createCommand(cloud, 'list', 'Display a list of your devices, as well as their variables and functions', {
params: '[filter]',
handler: (args) => {
const CloudCommands = require('../cmd/cloud');
return new CloudCommands().claimDevice(args.params.deviceID);
return new CloudCommands().listDevices(args);
},
examples: {
'$0 $command 123456789': 'Claim device by id to your account'
}
epilogue: 'Param filter can be: online, offline, a platform name (photon, electron, etc), a device ID or name'
});

commandProcessor.createCommand(cloud, 'list', 'Display a list of your devices, as well as their variables and functions', {
params: '[filter]',
commandProcessor.createCommand(cloud, 'claim', 'Register a device with your user account with the cloud', {
params: '<deviceID>',
handler: (args) => {
const CloudCommands = require('../cmd/cloud');
return new CloudCommands().listDevices(args.params.filter);
return new CloudCommands().claimDevice(args);
},
epilogue: 'Param filter can be: online, offline, a platform name (photon, electron, etc), a device ID or name'
examples: {
'$0 $command 123456789': 'Claim device by id to your account'
}
});

commandProcessor.createCommand(cloud, 'remove', 'Release a device from your account so that another user may claim it', {
Expand All @@ -41,7 +41,7 @@ module.exports = ({ commandProcessor, root }) => {
},
handler: (args) => {
const CloudCommands = require('../cmd/cloud');
return new CloudCommands().removeDevice(args.params.device, args);
return new CloudCommands().removeDevice(args);
},
examples: {
'$0 $command 0123456789ABCDEFGHI': 'Remove device by id from your account'
Expand All @@ -52,7 +52,7 @@ module.exports = ({ commandProcessor, root }) => {
params: '<device> <name>',
handler: (args) => {
const CloudCommands = require('../cmd/cloud');
return new CloudCommands().renameDevice(args.params.device, args.params.name);
return new CloudCommands().renameDevice(args);
},
examples: {
'$0 $command red green': 'Rename red device to green'
Expand All @@ -62,20 +62,20 @@ module.exports = ({ commandProcessor, root }) => {
commandProcessor.createCommand(cloud, 'flash', 'Pass a binary, source file, or source directory to a device!', {
params: '<device> [files...]',
options: Object.assign({}, compileOptions, {
'yes': {
boolean: true,
description: 'Answer yes to all questions'
'product': {
description: 'Target a device within the given Product ID or Slug'
}
}),
handler: (args) => {
const CloudCommands = require('../cmd/cloud');
return new CloudCommands().flashDevice(args.params.device, args.params.files, args);
return new CloudCommands().flashDevice(args);
},
examples: {
'$0 $command blue': 'Compile the source code in the current directory in the cloud and flash to device blue',
'$0 $command green tinker': 'Flash the default Tinker app to device green',
'$0 $command red blink.ino': 'Compile blink.ino in the cloud and flash to device red',
'$0 $command orange firmware.bin': 'Flash the pre-compiled binary to device orange',
'$0 $command blue --product 12345': 'Compile the source code in the current directory in the cloud and flash to device blue within product 12345'
}
});

Expand All @@ -88,7 +88,7 @@ module.exports = ({ commandProcessor, root }) => {
}),
handler: (args) => {
const CloudCommands = require('../cmd/cloud');
return new CloudCommands().compileCode(args.params.deviceType, args.params.files, args);
return new CloudCommands().compileCode(args);
},
examples: {
'$0 $command photon': 'Compile the source code in the current directory in the cloud for a Photon',
Expand All @@ -100,9 +100,19 @@ module.exports = ({ commandProcessor, root }) => {

commandProcessor.createCommand(cloud, 'nyan', 'Make your device shout rainbows', {
params: '<device> [onOff]',
options: {
'product': {
description: 'Target a device within the given Product ID or Slug'
}
},
handler: (args) => {
const CloudCommands = require('../cmd/cloud');
return new CloudCommands().nyanMode(args.params.device, args.params.onOff);
return new CloudCommands().nyanMode(args);
},
examples: {
'$0 $command green': 'Make the device named `blue` start signaling',
'$0 $command green off': 'Make the device named `blue` stop signaling',
'$0 $command blue --product 12345': 'Make the device named `blue` within product `12345` start signaling'
}
});

Expand Down
Loading

0 comments on commit 4c5df70

Please sign in to comment.