1
0
Fork 0
A Zsh helper to auto-correct the current command via ChatGPT
Go to file
Gürkan 79551117ac RefactorGPT 😾 2023-03-17 15:20:46 +01:00
.gitignore Initial push 2023-03-17 13:28:36 +01:00
LICENSE Initial commit 2023-03-17 13:01:21 +01:00
README.md RefactorGPT 😾 2023-03-17 15:20:46 +01:00
demo.gif Initial push 2023-03-17 13:28:36 +01:00
example.zsh Initial push 2023-03-17 13:28:36 +01:00
go.mod Initial push 2023-03-17 13:28:36 +01:00
go.sum Initial push 2023-03-17 13:28:36 +01:00
oh-my-gpt-correction.go RefactorGPT 😾 2023-03-17 15:20:46 +01:00

README.md

oh-my-gpt-correction

A Zsh helper to auto-correct the current command via ChatGPT.

Just compile the go code to executable.

Code is written badly but it does its job Code is now edited with ChatGPT, since it's better than me in golang 💩

  • Looks for an API key in CHATGPT_API_KEY environment variable
  • It accepts one argument, intended to get a whole command inside this argument
  • Exit codes are:
    • 1: Chat completion error (remote or lib-wise issues)
    • 2: No API key given
    • 3: Can't find an issue with given command
    • 4: No command given
  • In case of a suggestion, it prints 2 lines:
    • First line is colored diff from original command
    • Second line is the original suggestion
  • We are catching this output on ZSH part and utilise accordingly

Demo

A simple demo