Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get Stack Overflow answers inside a terminal? [closed]

Is there a way to query Stack Overflow directly from the command line and get back the most upvoted answer to the first question that comes up for that query?

I really mislike having to open up my browser whenever I want to brush up on my knowledge of writing RegExes for matching XHTML tags.

like image 883
metakermit Avatar asked Jan 11 '13 20:01

metakermit


People also ask

How do I reopen a Stack Overflow question?

You can find a link to the site's meta in two places in the site's top bar: under the "help" menu (the question-mark icon) in the upper right, and in the Stack Exchange site switcher (under the Stack Exchange in the upper right. Reopening a question follows the same process as closing a question.

How do you get your Stack Overflow answered?

First, make sure you've asked a good question. To get better answers, you may need to put additional effort into your question. Edit your question to provide status and progress updates. Document your own continued efforts to answer your question.

Why was my question closed on Stack Overflow?

This question doesn't meet a Stack Overflow guideline. If you believe the question can be reworded to fit within the scope, consider editing the question or leaving comments for improvement. Note: If you choose this close reason, you will be shown another set of options (which vary by site):

What is a closed question Stack Overflow?

Questions posted on Stack Overflow which are not related to programming topics, are marked as 'closed' by experienced users and community moderators. A question can be 'closed' for five reasons - duplicate, off-topic, subjective, not a real question and too localized.


1 Answers

Yes, it is possible! Try out Benjamin Gleitzman's excellent tool howdoi.

It works like this:

$ howdoi get stackoverflow answers inside a terminal

and the program will query StackOverflow for keywords "get stackoverflow answers inside a terminal", find the question that best matches these terms and return the code from the best answer to that question.

You can also add the -a option to get the full answer, not just the code. So to get an answer for your example query, you would do:

$ howdoi -a RegEx match XHTML tags 

Installation

If you have Python & pip installed, you can get it from the Cheese shop.

$ pip install howdoi

More help

Enter howdoi -h for complete usage instructions.

like image 131
metakermit Avatar answered Sep 22 '22 21:09

metakermit