diff --git a/lib/controller.js b/lib/controller.js index e9b4c00a..77b3cff4 100644 --- a/lib/controller.js +++ b/lib/controller.js @@ -127,7 +127,23 @@ Tessel.get = function(opts) { tessels = reconciledTessels; // Run the heuristics to pick which Tessel to use return controller.runHeuristics(opts, tessels) - .then(logAndFinish); + .then(function finalSection(tessel) { + // If the heuristics were able to narrow it down to a single Tessel + if (tessel) { + // Log we found it and return it to the caller + return logAndFinish(tessel); + } + // If we couldn't narrow it down + else { + // Open up an interactive menu for the user to choose + return controller.menu.create(tessels, {}, 'Which Tessel did you mean to use?') + // Once they choose + .then(function(tessel) { + // Log we found it and return it to the caller + return logAndFinish(tessel); + }); + } + }); }); } } @@ -688,15 +704,15 @@ controller.menu = { if (tessel.lanConnection) { if (!tessel.lanConnection.authorized) { - rtm.add(index + ') ' + tessel.name + ': ' + tessel.lanConnection.ip + ' (not authorized) \n'); + rtm.add(index + ') ' + tessel.name + ': ' + '[LAN] (not authorized) \n'); } else { - rtm.add(index + ') ' + tessel.name + ': ' + tessel.lanConnection.ip + ' (authorized) \n'); + rtm.add(index + ') ' + tessel.name + ': [LAN] \n'); } } else if (tessel.usbConnection) { rtm.add(index + ') ' + tessel.name + ': [USB] \n'); } else { - reject('Type of Tessel unkonwn: ', tessel); + reject('Type of Tessel unknown: ', tessel); } done(); },