-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add neutral wifi command to list Tessel Wifi Information #282
Conversation
Fix JSHINT issues
b14873a
to
9869ac3
Compare
function closeFailedCommand(err) { | ||
// If the returned value is an error | ||
// Allow options to be partially applied | ||
function closeFailedCommand(opts, err) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MrNice what's the rationale modifying this function? You could previouslyt report an error if you pass it an error or you can have it warn the user if it's just a string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Undoing, sorry.
@MrNice thanks for the contribution! It works really well when Tessel is connected. I added a few implementation notes on the relevant lines. In addition, the
Lastly, you'll have to run Let me know if you have any questions! |
Actually, I can't reproduce the failure Travis detected... I'm restarting the test to check if it's an intermittent type of issue. |
Re: Travis: last night it bounced this PR for jshint reasons, so I added 15 That specific error with the reduce will be fixed if its just passed an I'll work on this stuff when I get home.
|
Ah the Travis issue is directly related to it being a build server with no USB peripherals. Somehow a path of code is running that attempts to get a USB Device List (not sure why this particular PR caused it though). I can look further into it later today. |
.filter(function(addr) { | ||
return addr.length; | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to see this consolidated. The last three could be a single reduce
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the intent of the code is clear, why consolidate
I can replace the last three with the following
.reduce(function(list, ip) {
if (/addr/.exec(item)) {
var ip = chunk.split(':')[1];
if (ip.length) list.push[ip];
}
return list;
});
But it doesn't make it more clear (to me) what is happening.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:/
This is what reduce
is for: consolidating map/filter operations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll change it if that's wanted, but I don't think it's clearer.
On Tue, Sep 8, 2015 at 10:08 AM, Rick Waldron notifications@github.com
wrote:
In lib/controller.js
#282 (comment):
.map(function(line) {
return line.split(' ');
})
.reduce(function(a, b) {
return a.concat(b);
})
.filter(function(item) {
return /addr/.exec(item);
})
.map(function(chunk) {
return chunk.split(':')[1];
})
.filter(function(addr) {
return addr.length;
});
:/
This is what reduce is for: consolidating map/filter operations.
—
Reply to this email directly or view it on GitHub
https://github.com/tessel/t2-cli/pull/282/files#r38951868.
In addition to @johnnyman727's review points and fixing the existing failure, this needs new tests to cover the new behavior. |
Is this a reasonable error message? ~/s/t/bin ❯❯❯ iojs tessel-2.js wifi
INFO Connecting to Tessel...
INFO Connected to pixel over USB
ERR! This Tessel is not connected to Wi-Fi |
@MrNice the issue with the spec suggests:
I'd suggest one modification:
|
@MrNice did you need any more help with this or are you all good? |
Oh I'm rushing around busy. Got those other 2 pr's to wrap up first :( On Wed, Sep 9, 2015 at 7:38 PM, Jon notifications@github.com wrote:
|
No worries - just wanted to make sure you weren't hung up on anything from me. |
@MrNice can I help merge this? |
@johnnyman727 Wrapping this up and adding tests. Did we ever figure out travis? |
Closing in favor of rebased and fixed #362. |
It does this:
Adds two commands, and a fairly painful method to wifi.js.