gitmyhub

howdoi

Python ★ 11k updated 2mo ago

instant coding answers via the command line

howdoi is a command-line tool that fetches code answers from Stack Overflow and prints them directly in your terminal, so you get quick coding snippets without breaking focus to open a browser.

Pythonsetup: easycomplexity 1/5

howdoi is a command-line tool that retrieves coding answers from Stack Overflow without requiring you to open a browser. You type a question in plain English, and it returns a code snippet directly in the terminal. For example, typing "howdoi format date bash" prints back a one-liner shell command. The idea is to keep you in the console instead of breaking focus to search the web.

Installation is a single command: either "pip install howdoi" for Python users or "brew install howdoi" on a Mac with Homebrew. It requires Python 3.7 or newer.

The tool supports several options. By default it returns one answer, but you can ask for multiple answers, display the full answer text rather than just the snippet, show only the link to the source, or get output in JSON format. You can also choose which search engine howdoi uses in the background (Google, Bing, or DuckDuckGo) and which StackExchange site to query, which lets you ask questions about cooking or other topics the same way you would ask about code.

Answers can be saved to a personal stash for later reference, viewed, individually removed, or cleared entirely. For frequently used options, the README includes an example alias you can add to your shell profile to run howdoi with colorized output and five results by default.

Third-party integrations exist for Slack, Telegram, Discord, Emacs, VS Code, and Alfred on macOS, allowing the same query-and-answer workflow from chat tools and editors. The project has over a dozen listed contributors and links to a dedicated contributing guide for anyone who wants to improve it.

Where it fits