Command-Kelp is a command-line tool designed to simplify your interaction with the command line by using natural language commands. It provides three main functions to enhance your command-line experience: generating commands from descriptions, correcting previous commands, and offering an interactive menu for executing, explaining, and copying commands.
To correct the previous command:
$ kelp
To generate a command from a description:
$ kelp <your instructions here>
More examples in the Usage section.
To install Command-Kelp, you need to have Python 3.x and pip
installed. Run the following command:
$ git clone git@github.com:DaivdYuan/command-kelp.git
$ cd command-kelp && pip install .
Run kelp
for the first time to auto-configure Command-Kelp.
To use Command-Kelp, you need to set the environment variable OPENAI_API_KEY
to your OpenAI API key. You can find your API key here.
To use the automatic api key configuration, just run kelp again:
$ kelp
Alternatively, you can set the environment variable manually, preferably in your .bashrc
or .zshrc
file:
export OPENAI_API_KEY="your_api_key"
$ kelp [options] [description]
You can use the kelp
command along with a description to generate a corresponding command. Simply provide a brief description of what you want to achieve, and Command-Kelp will suggest the appropriate command.
$ kelp remove the latest commit in git
> git reset --hard HEAD~1
$ kelp compress ./data into a tar.gz file
> tar -czvf data.tar.gz ./data
Similar to the well-known thefuck
package, Command-Kelp can correct your previous command if you mistype it or make a syntax error. Just type kelp
or kelp fuck
, and Command-Kelp will attempt to correct the previous command.
# WRONG command
$ df-h
command not found: df-h
# corrected
$ kelp
> df -h
# WRONG command
$ npm create app react --typescript
npm ERR! could not determine executable to run
# corrected
$ kelp
> npx create-react-app my-app --template typescript
After generating a command or correcting a previous one, Command-Kelp will present you with an interactive menu for the suggested command. This menu includes options to execute, explain, and copy the command to your clipboard.
Contributions to Command-Kelp are welcome! Feel free to open issues and pull requests in the GitHub repository.
Command-Kelp is released under the MIT License.