Skip to content

Commit

Permalink
minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
keeramis committed May 24, 2024
1 parent 76aaff7 commit 0ceaf4d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
17 changes: 9 additions & 8 deletions src/cli/wifi.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ module.exports = ({ commandProcessor, root }) => {
The JSON file for passing Wi-Fi credentials should look like this:
{
"network": "my_ssid",
"security": "WPA2_AES",
"security": "WPA2_PSK",
"password": "my_password"
}
The security property can be NONE, WEP, WPA2_AES, WPA2_TKIP, WPA2_AES+TKIP, WPA_AES, WPA_TKIP, WPA_AES+TKIP.
The security property can be NONE, WEP, WPA_PSK, WPA2_PSK, WPA3_PSK, WPA_WPA2_PSK, WPA2_WPA3_PSK.
For enterprise Wi-Fi, set security to WPA_802.1x or WPA2_802.1x and provide the eap, username, outer_identity, client_certificate, private_key and root_ca properties.
`)
});
Expand All @@ -54,17 +54,18 @@ module.exports = ({ commandProcessor, root }) => {
},
examples: {
'$0 $command': 'Prompt for Wi-Fi credentials and send them to a device',
'$0 $command --file credentials.json': 'Read Wi-Fi credentials from credentials.json and send them to a device'
'$0 $command --file credentials.json': 'Read Wi-Fi credentials from credentials.json and send them to a device',
'$0 $command --ssid <SSID>': 'Join a known network specified by SSID'
},
epilogue: unindent(`
The JSON file for passing Wi-Fi credentials should look like this:
{
"network": "my_ssid",
"security": "WPA2_AES",
"security": "WPA2_PSK",
"password": "my_password"
}
The security property can be NONE, WEP, WPA2_AES, WPA2_TKIP, WPA2_AES+TKIP, WPA_AES, WPA_TKIP, WPA_AES+TKIP.
The security property can be NONE, WEP, WPA_PSK, WPA2_PSK, WPA3_PSK, WPA_WPA2_PSK, WPA2_WPA3_PSK.
For enterprise Wi-Fi, set security to WPA_802.1x or WPA2_802.1x and provide the eap, username, outer_identity, client_certificate, private_key and root_ca properties.
`)
});
Expand All @@ -85,7 +86,7 @@ module.exports = ({ commandProcessor, root }) => {
return new WiFiCommands().listNetworks();
},
examples: {
'$0 $command': 'Clears the list of wifi credentials on your device',
'$0 $command': 'Lists the wifi networks on your device',
}
});

Expand All @@ -96,7 +97,7 @@ module.exports = ({ commandProcessor, root }) => {
return new WiFiCommands().removeNetwork(args.params.ssid);
},
examples: {
'$0 $command ssid': 'Removes network from the device',
'$0 $command ssid': 'Removes a network specified by SSID from the device',
}
});

Expand All @@ -106,7 +107,7 @@ module.exports = ({ commandProcessor, root }) => {
return new WiFiCommands().getCurrentNetwork();
},
examples: {
'$0 $command ssid': 'Gets the current network',
'$0 $command ssid': 'Gets the network that the device is currently connected to',
}
});

Expand Down
5 changes: 2 additions & 3 deletions src/lib/wifi-control-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,8 @@ module.exports = class WiFiControlRequest {
const networks = replyObject.networks;
if (networks.length) {
networks.forEach((network) => {
const passwordProtected = network.credentialsType === 0 ? 'Open' : null;
const currentSsid = passCurrNw && replyObjectCurrNw ? replyObjectCurrNw.ssid : null;
const networkInfo = `- ${network.ssid} (${WifiSecurityEnum[network.security]})${passwordProtected ? `, ${passwordProtected}` : ''}`;
const networkInfo = `- ${network.ssid} (${WifiSecurityEnum[network.security]})`;
if (currentSsid === network.ssid) {
this.ui.stdout.write(`${networkInfo} - current network${os.EOL}`);
} else {
Expand All @@ -400,7 +399,7 @@ module.exports = class WiFiControlRequest {
this.ui.stdout.write('\tNo Wi-Fi networks found.');
this.ui.stdout.write(os.EOL);
return true;
}
}
}

async removeWifi(ssid) {
Expand Down

0 comments on commit 0ceaf4d

Please sign in to comment.