Skip to content

DaivdYuan/command-kelp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Command-Kelp: Natural Language Command Line Helper

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.

Table of Contents

Quick Start

To correct the previous command:

$ kelp 

To generate a command from a description:

$ kelp <your instructions here>

More examples in the Usage section.

Installation

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"

Usage

General

$ kelp [options] [description]

Generating Commands

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 

Correcting Commands

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 

Interactive Command Menu

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.

Contributing

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.

About

a natural language command line helper

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published