Giter VIP home page Giter VIP logo

lazyshell's Introduction

LazyShell

LazyShell is a GPT-3 powered utility for Zsh that helps you write and modify console commands using natural language. Perfect for those times when you can't remember the command line arguments for tar and ffmpeg, or when you just want to save time by having AI do the heavy lifting. The tool uses your current command line content (if any) as a base for your query, so you can issue modification requests for it. Invoke the completion with ALT+G hotkey; you still have to manually press enter to execute the suggested command.

Screenshot

LazyShell is currently in alpha stage and may have bugs. Currently only Zsh is supported.

Query examples:

Unpack download.tar.gz

Start nginx server in docker
    Mount current dir

Speed up the video 2x using ffmpeg
    Remove audio track

Installation

Get OpenAI API key from OpenAI dashboard.

# install prerequisites
brew install curl jq

# Download the script
curl -o ~/.lazyshell.zsh https://raw.githubusercontent.com/not-poma/lazyshell/master/lazyshell.zsh

# Add the following lines to your .zshrc
export OPENAI_API_KEY=<your_api_key>
[ -f ~/.lazyshell.zsh ] && source ~/.lazyshell.zsh

After that restart your shell. You can invoke the completion with ALT+G hotkey.

Contributing

This script is a crude hack, so any help is appreciated, especially if you can write zsh completion scripts. Feel free to open an issue or a pull request.

Inspired by https://github.com/TheR1D/shell_gpt

TODO

  • support for other shells
  • support keyboard interrupts
  • token streaming
  • companion tool that explains the current command line contents
  • allow query editing while the previous one is in progress
  • make some kind of preview before replacing the buffer
  • better json escaping
  • better error handling
  • query history
  • create brew package
  • maybe choose a better default shortcut?

lazyshell's People

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.