Skip to content

Commit 9c0221d

Browse files
committed
Refactor cmd() function to insert generated command into command line buffer, removing the confirmation prompt for execution.
1 parent 2536baa commit 9c0221d

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

.zshrc

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -445,17 +445,9 @@ cmd() {
445445
return
446446
fi
447447
local cmd=$(llm -x -s "We are on the command line for a system identified as \`$(uname -a)\`. Show me a command line comand for the following in a code block. Be brief and concise." "$*")
448-
echo -e "\n\x1b[32m$cmd\x1b[0m\n"
449-
450-
# Ask for confirmation (default to yes)
451-
echo -n "Run this command? [Y/n] "
452-
read -r response
453-
# If response is empty (just pressed enter) or starts with y/Y, run the command
454-
if [[ -z "$response" || "$response" =~ ^[Yy] ]]; then
455-
eval "$cmd"
456-
else
457-
echo "Command not executed."
458-
fi
448+
449+
# Insert the command into the command line buffer
450+
print -z "$cmd"
459451
}
460452

461453
# Generate passwords

0 commit comments

Comments
 (0)