From 04615bdd84aa6d5721986cc286f94114d48b2bc6 Mon Sep 17 00:00:00 2001 From: Harry Wixley Date: Mon, 17 Jul 2023 11:38:11 +0100 Subject: [PATCH] adding support for asking for command explanations GPT-commit: Refactor wix-cli.sh - modified functions to improve performance and fix bugs. --- wix-cli.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/wix-cli.sh b/wix-cli.sh index 07fd170..12b0adb 100755 --- a/wix-cli.sh +++ b/wix-cli.sh @@ -472,6 +472,10 @@ if [ $num_args -eq 0 ]; then echo "- genb64 ${ORANGE}: generate and copy pseudo-random base64 string (of default length 32)${RESET}" echo "- copy ${ORANGE}: copy a string or the output of a shell command (using \$() syntax) to your clipboard${RESET}" echo "" + h1_text "SMART UTILITIES:" + echo "- explain \"\" ${ORANGE}: explain a command${RESET}" + echo "" + # h1_text "CLI management:" # echo "- edit" # echo "- save" @@ -1008,6 +1012,22 @@ elif [ "$1" = "rgxmatch" ]; then fi fi +# SMART UTILITIES + +elif [ "$1" = "explain" ]; then + if arggt "1"; then + cmd="$2" + info_text "Finding explanation for $cmd..." + cmd="${2// /+}" + openurl "https://explainshell.com/explain?cmd=$cmd" + else + info_text "Enter the command you would like to explain:" + read -r cmd + info_text "Finding explanation for $cmd..." + cmd="${2// /+}" + openurl "https://explainshell.com/explain?cmd=$cmd" + fi + # UPDATE elif [ "$1" = "update" ]; then