[bin] format and correct comments

This commit is contained in:
Lucien Cartier-Tilet 2023-06-15 14:23:55 +02:00
parent 7b0833252a
commit c4c80945e8
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA

View File

@ -195,7 +195,7 @@ set with a valid OpenAI key.
# If the user passes '-h', '--help', or 'help' print out a little bit of help.
# text.
case "$1" in
"-h" | "--help" | "help")
"-h" | "--help" | "help")
printf 'Generate kaomojis on request.\n\n'
printf 'Usage: %s [kind]\n' "$(basename "$0")"
exit 1
@ -206,13 +206,13 @@ esac
# kind of Kaomoji produced.
sentiment=""
if [[ $1 != "" ]]; then
sentiment=" $1"
sentiment=" $1"
fi
# Ask mods to generate Kaomojis. Save the output in a variable.
kaomoji="$(mods "generate 10${sentiment} kaomojis. number them and put each one on its own line.")"
if [[ $kaomoji == "" ]]; then
exit 1
exit 1
fi
# Pipe mods output to gum so the user can choose the perfect kaomoji. Save that
@ -220,13 +220,13 @@ fi
# in front of the Kaomoji.
choice="$(echo "$kaomoji" | gum choose | cut -d ' ' -f 2)"
if [[ $choice == "" ]]; then
exit 1
exit 1
fi
# If the current session is Wayland, copy with wl-copy, otherwise copy with xclipboard
if [ "$XDG_SESSION_TYPE" = "wayland" ]
then printf '%s' "$choice" | wc-copy # X11
else printf '%s' "$choice" | xclip -sel clip # Wayland
then printf '%s' "$choice" | wc-copy # Wayland
else printf '%s' "$choice" | xclip -sel clip # X11
fi
# We're done!