Last active
February 10, 2024 09:07
-
-
Save moritztim/f737e41f23d529cce9fb38fa2dfc3180 to your computer and use it in GitHub Desktop.
ShellGPT Extras
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
## Generate code with Shell GPT's code role and watch it being written in VSCode | |
aicode() { | |
# Check if input is available from the pipe | |
if [ -t 0 ]; then | |
# If no input from pipe, pass only the prompt to the AI | |
sgpt --code "$@" | codium - | |
else | |
# If input is received from pipe, concatenate it with the provided prompt | |
cat - | sgpt --code "$@" | codium - | |
fi | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
## Generate commit messages with Shell GPT 3.5-turbo and the custom commit role | |
cgpt() { | |
commit_msg=$(git diff --staged | sgpt --model="gpt-3.5-turbo" --role=commit) | |
echo -n "Generated Message: \n $commit_msg \n Is this message ok? [Y/n]: " | |
read confirm | |
if [[ $confirm == "y" || $confirm == "Y" || $confirm == "" ]]; then | |
git commit -m "$commit_msg" | |
command git commit -m "$commit_msg" "$@" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment