- Download
fixit.sh:
wget https://raw.githubusercontent.com/ag8/tony/main/fixit.sh
- Add the following to your
.bashrcfile:
shopt -s histverify
tony() {
# Get the second-to-last command from the history
LAST_CMD=$(history | tail -n 2 | head -n 1 | sed 's/^[ \t]*[0-9]*[ \t]*//')
# Execute the last command and capture the output
CMD_OUTPUT=$(eval $LAST_CMD 2>&1)
OPTIONAL_PARAM=${1:-"DefaultValue"}
# Call the fixit.sh script with the last command and its output as arguments
~/fixit.sh "$LAST_CMD" "$CMD_OUTPUT" "$OPTIONAL_PARAM"
}-
Make sure your
OPENAI_API_KEYenvironment variable is set -
source .bashrc
Got problems? Ask tony!
You can also add your own additional information: