Skip to content

Commit

Permalink
Refactor and add proper error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
keeramis committed May 23, 2024
1 parent 6b39eeb commit ba71cf7
Show file tree
Hide file tree
Showing 6 changed files with 318 additions and 281 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
"test:e2e": "npm run build -- --target host && mocha 'test/{,!(__fixtures__)/**}/*.e2e.js' --timeout 120000 --exit",
"test:e2e:ci": "npm run test:e2e:no-device -- --forbid-only",
"test:e2e:no-device": "npm run test:e2e -- --grep @device --invert",
"test:e2e:wifi": "npm run test:e2e -- --grep @wifi",
"test:e2e:watch": "npm run test:e2e -- --watch --watch-extensions js,json",
"test:e2e:inspect": "npm test:e2e -- --inspect-brk",
"test:e2e:silent": "PARTICLE_NOOP=$(npm run test:e2e:ci)",
Expand Down
10 changes: 10 additions & 0 deletions src/cli/wifi.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,16 @@ module.exports = ({ commandProcessor, root }) => {
'$0 $command ssid': 'Removes network from the device',
}
});

commandProcessor.createCommand(wifi, 'status', 'Gets the current network', {
handler: (args) => {
const WiFiCommands = require('../cmd/wifi');
return new WiFiCommands().getCurrentNetwork();
},
examples: {
'$0 $command ssid': 'Gets the current network',
}
});

return wifi;
};
Expand Down
4 changes: 4 additions & 0 deletions src/cmd/wifi.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,8 @@ module.exports = class WiFiCommands extends CLICommandBase {
removeNetwork(ssid) {
return this.wifiControlRequest.removeNetwork(ssid);
}

getCurrentNetwork() {
return this.wifiControlRequest.getCurrentNetwork();
}
}
Loading

0 comments on commit ba71cf7

Please sign in to comment.