Skip to content

Commit

Permalink
Add option for manual entry if no networks are detected
Browse files Browse the repository at this point in the history
Fixes #121
  • Loading branch information
brycekahle committed Jan 14, 2016
1 parent 984e750 commit 747eb45
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion commands/WirelessCommand/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ var strings = {
'credentialsNeeded': 'You will need to know the password for your Wi-Fi network (if any) to proceed.',
'selectNetwork': 'Select the Wi-Fi network with which you wish to connect your Photon:',
'startingSetup': "Congratulations, you're on your way to awesome",
'rescanLabel': '[rescan networks]'
'rescanLabel': '[rescan networks]',
'manualEntryLabel': '[manual entry]'
};

// TODO: DRY this up somehow
Expand Down Expand Up @@ -604,8 +605,13 @@ WirelessCommand.prototype.__configure = function __configure(ssid, cb) {

networks = removePhotonNetworks(ssids(networks));

var noNetworks = networks.length === 0;

networks.unshift(new inquirer.Separator());
networks.unshift(strings.rescanLabel);
if (noNetworks) {
networks.unshift(strings.manualEntryLabel);
}
networks.unshift(new inquirer.Separator());

prompt([{
Expand All @@ -626,6 +632,11 @@ WirelessCommand.prototype.__configure = function __configure(ssid, cb) {
return start();
}

if (ans.network === strings.manualEntryLabel) {
scanChoice({ manual: true });
return;
}

network = ans.network;

prompt([{
Expand Down

0 comments on commit 747eb45

Please sign in to comment.