Skip to content

Commit

Permalink
Fix eol
Browse files Browse the repository at this point in the history
  • Loading branch information
keeramis committed Jun 17, 2024
1 parent 352ce07 commit ad8bf3b
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/cmd/device-protection.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ module.exports = class DeviceProtectionCommands extends CLICommandBase {

let res;
if (!s.protected && !s.overridden) {
res = `Open (not protected)${os.EOL}Run 'particle device-protection enable' to protect the device${os.EOL}`;
res = `Open (not protected)${os.EOL}Run 'particle device-protection enable' to protect the device`;
} else if (s.protected && !s.overridden) {
res = `Protected${os.EOL}Run 'particle device-protection disable' unlock the device${os.EOL}`;
res = `Protected${os.EOL}Run 'particle device-protection disable' unlock the device`;
} else if (s.overridden) {
res = `Protected (service mode)${os.EOL}Run 'particle device-protection enable' to enable protection${os.EOL}`;
res = `Protected (service mode)${os.EOL}Run 'particle device-protection enable' to enable protection`;
}

this.ui.stdout.write(`Device protection: ${res}${os.EOL}`);
Expand All @@ -50,10 +50,10 @@ module.exports = class DeviceProtectionCommands extends CLICommandBase {

async disableProtection({ open } = {}) {
return this._withDevice(async () => {
const s = await this._getDeviceProtection();
let s = await this._getDeviceProtection();

if (!s.protected && !s.overridden) {
this.ui.stdout.write(`Device is not protected`);
this.ui.stdout.write(`Device is not protected${os.EOL}`);
return;
}

Expand All @@ -66,7 +66,7 @@ module.exports = class DeviceProtectionCommands extends CLICommandBase {
// console.log(`CLI -> Device:\n\tserver_nonce=${serverNonce.toString('base64')}`);
r = await this.device.unprotectDevice({ action: 'prepare', serverNonce });
if (!r.protected) {
this.ui.stdout.write('Device is not protected');
this.ui.stdout.write(`Device is not protected${os.EOL}`);
return;
}
const { deviceNonce, deviceSignature, devicePublicKeyFingerprint } = r;
Expand Down Expand Up @@ -107,9 +107,9 @@ module.exports = class DeviceProtectionCommands extends CLICommandBase {
const success = await this._markAsDevelopmentDevice(true);

if (!success) {
this.ui.stdout.write('Failed to mark device as development device. Protection will be automatically enabled after a power cycle');
this.ui.stdout.write(`Failed to mark device as development device. Protection will be automatically enabled after a power cycle${os.EOL}`);
} else {
this.ui.stdout.write('Device is now in development mode');
this.ui.stdout.write(`Device is now in development mode${os.EOL}`);
}
});
}
Expand Down Expand Up @@ -153,20 +153,20 @@ module.exports = class DeviceProtectionCommands extends CLICommandBase {
}

if (s.protected && !s.overridden) {
this.ui.stdout.write(`Device is protected`);
this.ui.stdout.write(`Device is protected${os.EOL}`);
return;
}

if (s.overridden) {
// terminate unlock
await this.device.unprotectDevice({ action: 'reset' });

this.ui.stdout.write(`Device is protected`);
this.ui.stdout.write(`Removing device from developement mode...`);
this.ui.stdout.write(`Device is protected${os.EOL}`);
this.ui.stdout.write(`Removing device from developement mode...${os.EOL}`);

const success = await this._markAsDevelopmentDevice(false);
if (!success) {
this.ui.stdout.write(`Failed to remove device from development mode. Ensure it is not in development mode for protection to work properly`);
this.ui.stdout.write(`Failed to remove device from development mode. Ensure it is not in development mode for protection to work properly${os.EOL}`);
}
return;
}
Expand All @@ -181,13 +181,13 @@ module.exports = class DeviceProtectionCommands extends CLICommandBase {

await this._flashBootloader(protectedBinary, 'enable');

this.ui.write(`Device is protected`);
this.ui.stdout.write(`Removing device from developement mode...`);
this.ui.write(`Device is protected${os.EOL}`);
this.ui.stdout.write(`Removing device from developement mode...${os.EOL}`);

const success = await this._markAsDevelopmentDevice(false);

if (!success) {
this.ui.stdout.write(`Failed to remove device from development mode. Ensure it is not in development mode for protection to work properly`);
this.ui.stdout.write(`Failed to remove device from development mode. Ensure it is not in development mode for protection to work properly${os.EOL}`);
}
}
});
Expand Down Expand Up @@ -250,7 +250,7 @@ module.exports = class DeviceProtectionCommands extends CLICommandBase {
if (this.device.isInDfuMode) {
this.ui.stdout.write(`Device is in DFU mode. Performing a reset to get the device in normal mode. Please wait...${os.EOL}`);
await this.resetDevice(this.device);
this.ui.stdout.write(`Done! Device is now in normal mode`);
this.ui.stdout.write(`Done! Device is now in normal mode${os.EOL}`);
await this.getUsbDevice(this.device);
}

Expand Down

0 comments on commit ad8bf3b

Please sign in to comment.