1
0
Fork 0
A Zsh helper to auto-correct the current command via ChatGPT
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Gürkan 79551117ac RefactorGPT 😾 2 weeks ago
.gitignore Initial push 2 weeks ago
LICENSE Initial commit 2 weeks ago
README.md RefactorGPT 😾 2 weeks ago
demo.gif Initial push 2 weeks ago
example.zsh Initial push 2 weeks ago
go.mod Initial push 2 weeks ago
go.sum Initial push 2 weeks ago
oh-my-gpt-correction.go RefactorGPT 😾 2 weeks ago

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