Skip to content
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 get-port-names helper to util #8

Merged

Conversation

WickedShell
Copy link
Contributor

@WickedShell WickedShell commented Mar 27, 2017

It's frequently useful to get the set of the available port names, and then be able to do work over it. This just exposes a helper so that the caller doesn't need to know what a CommPortIdentifier is and how to get it's name.

@peterschwarz peterschwarz self-assigned this Mar 30, 2017
@WickedShell
Copy link
Contributor Author

@peterschwarz rebased, and fixed some bad spelling in the commit message, and Travis now passes, so this should be ready for review.


(defn list-ports
"Print out the available ports.
The names printed may be passed to `serial.core/open` as printed."
[]
(doall (map #(println (.getName %)) (port-identifiers))))
(map println (get-port-names)))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

map is lazy, so this won't actually print. That's where the doall came in.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I keep forgetting that when I do that in the repl that would realize it... Sorry about that! Pushed a fix.

It's frequently useful to get the set of the available port names,
and then be able to do work over it. This just exposes a helper
so that the caller doesn't need to know what a CommPortIdentifier
is and how to get it's name.
@WickedShell
Copy link
Contributor Author

Is this waiting on anything from me? You've marked it as approved but I'm guessing you aren't waiting on anyone else to comment on it...

@peterschwarz peterschwarz merged commit a22cbd3 into peterschwarz:develop Jul 24, 2017
@peterschwarz
Copy link
Owner

Was just waiting on the build, and got a bit distracted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants