diff options
| author | sigoden <sigoden@gmail.com> | 2024-05-15 08:50:49 +0000 |
|---|---|---|
| committer | sigoden <sigoden@gmail.com> | 2024-05-16 00:39:29 +0000 |
| commit | 281bf5623dbf88b176801f3a780820801e15e70d (patch) | |
| tree | 2129e5078afe2cce2a17e43715731607131e3602 /bin | |
| download | llm-functions-docker-281bf5623dbf88b176801f3a780820801e15e70d.tar.gz | |
init commit
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/duckduckgo_search | 14 | ||||
| -rwxr-xr-x | bin/execute_command | 11 | ||||
| -rwxr-xr-x | bin/get_current_weather | 11 |
3 files changed, 36 insertions, 0 deletions
diff --git a/bin/duckduckgo_search b/bin/duckduckgo_search new file mode 100755 index 0000000..3c3f2eb --- /dev/null +++ b/bin/duckduckgo_search @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +set -e + +# @describe Use this function to search DuckDuckGo for a query. +# @meta require-tools ddgr +# @option --query! The query to search for. +# @option --max-results=5 The number of returned results. + +main() { + ddgr --num $argc_max_results --json "$argc_query" | \ + jq -r '.[] | "**[\(.title)](\(.url))**\n\(.abstract)\n"' +} + +eval "$(argc --argc-eval "$0" "$@")" diff --git a/bin/execute_command b/bin/execute_command new file mode 100755 index 0000000..fab84bd --- /dev/null +++ b/bin/execute_command @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +set -e + +# @describe Executes a shell command and returns the output. +# @option --shell-command~ "Shell command to execute, such as `ls -la`" + +main() { + eval $argc_shell_command +} + +eval "$(argc --argc-eval "$0" "$@")" diff --git a/bin/get_current_weather b/bin/get_current_weather new file mode 100755 index 0000000..ad45c5f --- /dev/null +++ b/bin/get_current_weather @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +set -e + +# @describe Get the current weather in a given location. +# @option --location! The city and state, e.g. San Francisco, CA + +main() { + curl "https://wttr.in/$(echo "$argc_location" | sed 's/ /+/g')?format=4&M" +} + +eval "$(argc --argc-eval "$0" "$@")" |
