Get directions for how to do anything in the terminal. Powered by ChatGPT. Like TLDR, but smarter.
cargo install howtoshell
howtoshell query "unpack a tar.gz file"
The howtoshell
command has two subcommands, query
and auth
. The auth
subcommand has two additional subcommands, login
and logout
.
The login
subcommand is used to log in to the ChatGPT API and only needs to be run once.
$ howtoshell auth login
The logout
subcommand is used to log out of the ChatGPT API and clear the API key from the local machine.
$ howtoshell auth logout
The query
subcommand is used to get directions on how to do something in the terminal. The query takes a single argument, which can be a word or a phrase.
$ howtoshell query "unpack a tar.gz file"
Internally, the query is prefixed with the phrase Provide a command to do the following in a terminal:
to limit the context of the query to commands in the terminal.
The response from the ChatGPT API will be printed to the terminal.
After installing the howto
command, you can add an alias to your shell's configuration file to make it easier to use. For example, if you use bash
, you can add the following to your ~/.bashrc
file:
alias howto="howtoshell query"
Then you can run the command like this (in a new terminal session):
$ howto "unpack a tar.gz file"
For the howtoshell
command to work, you need to get an API key for the OpeanAI API. Once you've signed up for an account, you can create an API key by going to the API Keys page and generating a new API. Currently the API key comes with $18.00 of free credits, which should be enough to run the howtoshell
command for a while. After the free credits are used up, the cost is $0.002 / 1K tokens. For more information on tokens and how to count them, see this OpenAI API article.
👤 Rich Baird
- Github: @richbai90
- LinkedIn: @richbai90
Give a ⭐️ if this project helped you!
This README was generated with ❤️ by readme-md-generator