Skip to content

Commit

Permalink
remove unused --yes flag from cloud compile and flash commands
Browse files Browse the repository at this point in the history
  • Loading branch information
busticated committed Apr 8, 2020
1 parent ea0eba6 commit 61ab4ad
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 18 deletions.
7 changes: 1 addition & 6 deletions src/cli/cloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,7 @@ 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'
}
}),
options: Object.assign({}, compileOptions),
handler: (args) => {
const CloudCommands = require('../cmd/cloud');
return new CloudCommands().flashDevice(args);
Expand Down
7 changes: 1 addition & 6 deletions src/cli/cloud.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ describe('Cloud Command-Line Interface', () => {
const argv = commandProcessor.parse(root, ['cloud', 'flash', 'my-device']);
expect(argv.clierror).to.equal(undefined);
expect(argv.params).to.eql({ device: 'my-device', files: [] });
expect(argv.yes).to.equal(false);
expect(argv.followSymlinks).to.equal(false);
expect(argv.target).to.equal(undefined);
});
Expand All @@ -206,7 +205,6 @@ describe('Cloud Command-Line Interface', () => {
expect(argv.clierror).to.have.property('data', 'device');
expect(argv.clierror).to.have.property('isUsageError', true);
expect(argv.params).to.eql({});
expect(argv.yes).to.equal(false);
expect(argv.followSymlinks).to.equal(false);
expect(argv.target).to.equal(undefined);
});
Expand All @@ -215,16 +213,14 @@ describe('Cloud Command-Line Interface', () => {
const argv = commandProcessor.parse(root, ['cloud', 'flash', 'my-device', 'blink.ino']);
expect(argv.clierror).to.equal(undefined);
expect(argv.params).to.eql({ device: 'my-device', files: ['blink.ino'] });
expect(argv.yes).to.equal(false);
expect(argv.followSymlinks).to.equal(false);
expect(argv.target).to.equal(undefined);
});

it('Parses options', () => {
const argv = commandProcessor.parse(root, ['cloud', 'flash', 'my-device', '--yes', '--followSymlinks', '--target', '2.0.0']);
const argv = commandProcessor.parse(root, ['cloud', 'flash', 'my-device', '--followSymlinks', '--target', '2.0.0']);
expect(argv.clierror).to.equal(undefined);
expect(argv.params).to.eql({ device: 'my-device', files: [] });
expect(argv.yes).to.equal(true);
expect(argv.followSymlinks).to.equal(true);
expect(argv.target).to.equal('2.0.0');
});
Expand All @@ -240,7 +236,6 @@ describe('Cloud Command-Line Interface', () => {
'Options:',
' --target The firmware version to compile against. Defaults to latest version, or version on device for cellular. [string]',
' --followSymlinks Follow symlinks when collecting files [boolean]',
' --yes Answer yes to all questions [boolean]',
'',
'Examples:',
' particle cloud flash blue Compile the source code in the current directory in the cloud and flash to device blue',
Expand Down
5 changes: 2 additions & 3 deletions src/cmd/cloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const prompts = require('../lib/prompts');
const fs = require('fs');
const path = require('path');
const extend = require('xtend');
const util = require('util');
const chalk = require('chalk');

const arrow = chalk.green('>');
Expand Down Expand Up @@ -152,7 +151,7 @@ module.exports = class CloudCommand {
});
}

flashDevice({ target, followSymlinks, yes, params: { device, files } }) {
flashDevice({ target, followSymlinks, params: { device, files } }) {
return Promise.resolve()
.then(() => {
if (files.length === 0) {
Expand Down Expand Up @@ -277,7 +276,7 @@ module.exports = class CloudCommand {
return deviceType + '_firmware_' + Date.now() + '.bin';
}

compileCode({ target, followSymlinks, yes, saveTo, params: { deviceType, files } }) {
compileCode({ target, followSymlinks, saveTo, params: { deviceType, files } }) {
let api;
let platformId;
let targetVersion;
Expand Down
6 changes: 3 additions & 3 deletions src/cmd/flash.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ module.exports = class FlashCommand {
} else if (serial){
result = this.flashYModem({ binary, port, yes });
} else {
result = this.flashCloud({ device, files, target, yes });
result = this.flashCloud({ device, files, target });
}

return result.then(() => {
console.log ('\nFlash success!');
});
}

flashCloud({ device, files, target, yes }){
flashCloud({ device, files, target }){
const CloudCommands = require('../cmd/cloud');
const args = { target, yes, params: { device, files } };
const args = { target, params: { device, files } };
return new CloudCommands().flashDevice(args);
}

Expand Down

0 comments on commit 61ab4ad

Please sign in to comment.