Skip to main content

Use LLM to generate commands for your shell

Project description

Shell completion using LLM

Use LLM to generate and execute commands in your shell.

https://github.com/user-attachments/assets/c10d7a0f-48c3-4904-bb1b-4a1ce9f9ff8d

Installation

Install this plugin in the same environment as LLM.

llm install llm-cmd-comp

Then install the shell integration for your preferred shell.

  • Fish: add llm cmdcomp --init fish | source in a file in ~/.config/fish/conf.d/.
  • Zsh: add eval "$(llm cmdcomp --init zsh)" to your ~/.zshrc.
  • Bash: add eval "$(llm cmdcomp --init bash)" to your ~/.bashrc.

Usage

  1. Start typing a command.
  2. Activate the key binding (Alt-Backslash by default).
  3. Wait for the LLM to complete the command.
  4. Press enter if you are happy. Otherwise give feedback on the command and repeat from step 3.
  5. The LLM's command replaces the previous command you were writing.

Neat ways you can use this feature:

  • Type a command in English, convert it to bash.
    find all files larger than 100MB
    🪄 find . -type f -size +100M
  • Give extra instructions as comments.
    sed -i '' 's/search/replace/g' file.go # Now do it for all go files in the project
    🪄 find . -name '*.go' -exec sed -i '' 's/search/replace/g' {} +

Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:

cd llm-cmd-comp
python3 -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

pip install llm
llm install -e .

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llm_cmd_comp-1.2.0.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llm_cmd_comp-1.2.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file llm_cmd_comp-1.2.0.tar.gz.

File metadata

  • Download URL: llm_cmd_comp-1.2.0.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.10

File hashes

Hashes for llm_cmd_comp-1.2.0.tar.gz
Algorithm Hash digest
SHA256 6ec7332ffa38717520ba60981b040f17e4cc4ca4fd8d715b720adafcd4a78323
MD5 862d2b29c1ec0e912145d05aa6935b99
BLAKE2b-256 97e7d83bebb30550b4eeda91590b136ce85cf7727c3aa33398db33de718ff470

See more details on using hashes here.

File details

Details for the file llm_cmd_comp-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: llm_cmd_comp-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.10

File hashes

Hashes for llm_cmd_comp-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b5e6703d027b566e998616118830f033546fc0cfc137a03c7029e83e0625d6f9
MD5 beec073b8f7acb6b91667e74bb054a86
BLAKE2b-256 7e070160c873989f3bf492ec75d70db2946bbedd4585d6e04460c711ae6546a4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page