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?)
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();