Skip to content

Latest commit

 

History

History
35 lines (25 loc) · 1.13 KB

README.md

File metadata and controls

35 lines (25 loc) · 1.13 KB
shrs_openai

crates.io docs.rs MIT/Apache 2.0

This is a plugin for shrs. It enables the ability to use ChatGPT to help you out on common command like tasks like:

  • ask to write a command for you (list all stopped docker containers and delete them)
  • answer questions based on your shell environment (why did my last command not work?)
  • pass contents of files (why is this JSON file deformed?)

Using this plugin

First add this plugin to your dependencies

shrs_openai = { version = "0.0.2" }

Then include this plugin when initializing shrs

use shrs::prelude::*;
use shrs_openai::OpenaiPlugin;

let api_key = std::env::var("OPENAI_KEY").unwrap().to_string();

let myshell = ShellBuilder::default()
    .with_plugin(OpenaiPlugin::new(api_key))
    .build()
    .unwrap();