Last active
April 11, 2023 19:05
-
-
Save kebairia/1c3cdc1a5570689e69ac40c446e7cf5b to your computer and use it in GitHub Desktop.
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/bash | |
# Author: Zakaria Kebairia | |
# Email: 4.kebairia@gmail.com | |
# | |
# Description: This script prompts the user to select a prompt from a fil | |
# Set shell options: | |
# e: Exit immediately if a command exits with a non-zero status code, | |
# u: Treat unset variables as an error, | |
# o pipefail: Causes a pipeline to return the exit status of the last command in the pipeline that returned a non-zero status. | |
set -euo pipefail | |
# This file contains your prompts with their tags at the beginning | |
PROMPTS_FILE="$HOME/.local/share/prompts" | |
# Install dmenu from official Git repository | |
if ! command -v dmenu &> /dev/null | |
then | |
echo "'dmenu' command not found. Installing it..." | |
git clone https://git.suckless.org/dmenu | |
cd dmenu && sudo make install clean && cd .. | |
fi | |
# Prompt user to choose a prompt using dmenu and save it to a variable | |
prompt=$(awk -F'$' '{ print $1 }' "$PROMPTS_FILE" | dmenu -p "GPT 🤖: " -fn "FiraCode-15") | |
# Copy chosen prompt into the clipboard | |
grep "$prompt" "$PROMPTS_FILE" | cut -d'$' -f2 | xclip -selection clipboard |
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
shell_expert$You are a linux administrator with over 10 years of experience, and you have substantial experience with shell script. I want you to help me writing a shell script, I will give you code snippets, and you have to reformat it with google's style guide, add helpfull comments, and give me summary with your changes at the end.I need the output to be in code snippet as well. Confirmed ! | |
english_professor$You are an english professor with over 10 years of experience, and you have substantial experience with teaching. I want you to help me writing an essay, I will give my writing, and you have to reformat it using better words, add helpful comments, and give me summary with your changes at the end. Confirmed ! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment