You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .zshrc
+16-3Lines changed: 16 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -423,20 +423,34 @@ fi
423
423
424
424
# Generic helper to ask an LLM about anything
425
425
ask() {
426
+
if [ $#= 0 ];then
427
+
echo"usage: ask <some question>"
428
+
return 1
429
+
fi
426
430
if! _has llm;then
427
431
echo"llm tool not installed, run 'uv tool install llm'"
428
432
return
429
433
fi
430
-
llm -s "We are on the command line for a system identified as $(uname -a). Answer the following question. Be brief and concise.""$*"
434
+
local formatter=cat
435
+
if _has glow;then
436
+
formatter=glow
437
+
elif _has md2term;then
438
+
formatter=md2term
439
+
fi
440
+
llm -s "We are on the command line for a system identified as \`$(uname -a)\`. Answer the following question. Be brief and concise.""$*"|$formatter
431
441
}
432
442
433
443
# AI helper for command line syntax, like "list subprocesses of pid 1234"
434
444
cmd() {
445
+
if [ $#= 0 ];then
446
+
echo"usage: cmd <some command description>"
447
+
return 1
448
+
fi
435
449
if! _has llm;then
436
450
echo"llm tool not installed, run 'uv tool install llm'"
437
451
return
438
452
fi
439
-
local cmd=(llm "We are on the command line for a system identified as $(uname -a). Show me a macOS command line comand for the following in a code block. Be brief and concise.""$*")
453
+
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.""$*")
440
454
echo -e "\n\x1b[32m$cmd\x1b[0m\n"
441
455
echo -n "$cmd"| pbcopy
442
456
}
@@ -580,7 +594,6 @@ ggg() {
580
594
git status && \
581
595
hr committing && \
582
596
local msg=$(llm -x -s 'Summarize this git diff and produce a single sentence in a code block we can use for a commit message' -f <(git diff ; git diff --cached)| tr -d '\n')&& \
0 commit comments