From 03c4b6982293c5be31d7eda89b6dcb8c1a7a8059 Mon Sep 17 00:00:00 2001 From: sigoden Date: Sun, 19 May 2024 22:43:49 +0800 Subject: feat: supports functions in bash/js/python/ruby (#6) --- bin/get_current_weather | 11 ----------- bin/may_execute_command | 11 ----------- bin/search_duckduckgo | 16 ---------------- bin/search_wolframalpha | 24 ------------------------ 4 files changed, 62 deletions(-) delete mode 100755 bin/get_current_weather delete mode 100755 bin/may_execute_command delete mode 100755 bin/search_duckduckgo delete mode 100755 bin/search_wolframalpha (limited to 'bin') diff --git a/bin/get_current_weather b/bin/get_current_weather deleted file mode 100755 index 47102e0..0000000 --- a/bin/get_current_weather +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash -set -e - -# @describe Get the current weather in a given location. -# @option --location! The city and optionally the state or country, e.g., "London", "San Francisco, CA". - -main() { - curl -fsSL "https://wttr.in/$(echo "$argc_location" | sed 's/ /+/g')?format=4&M" -} - -eval "$(argc --argc-eval "$0" "$@")" diff --git a/bin/may_execute_command b/bin/may_execute_command deleted file mode 100755 index 6e35e3c..0000000 --- a/bin/may_execute_command +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash -set -e - -# @describe Executes a shell command. -# @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/search_duckduckgo b/bin/search_duckduckgo deleted file mode 100755 index c5ab565..0000000 --- a/bin/search_duckduckgo +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash -set -e - -# @describe Takes in a query string and returns search result from DuckDuckGo. -# Use it to answer user questions that require dates, facts, real-time information, or news. -# This ensures accurate and up-to-date answers. - -# @meta require-tools ddgr -# @env DDG_MAX_RESULTS=5 The max results to return. -# @option --query! The query to search for. - -main() { - ddgr -n $DDG_MAX_RESULTS --json "$argc_query" -} - -eval "$(argc --argc-eval "$0" "$@")" diff --git a/bin/search_wolframalpha b/bin/search_wolframalpha deleted file mode 100755 index a2dfdc7..0000000 --- a/bin/search_wolframalpha +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash -set -e - -# @describe Get an answer to a question using Wolfram Alpha. Input should the query in English. -# Use it to answer user questions that require computation, detailed facts, data analysis, or complex queries. -# This ensures accurate and precise answers. - -# @option --query! The query to search for. -# @env WOLFRAM_API_ID! - -main() { - local curl_args=( - -sSf -G - --data-urlencode "output=JSON" - --data-urlencode "format=plaintext" - --data-urlencode "input=$argc_query" - --data-urlencode "appid=$WOLFRAM_API_ID" - "https://api.wolframalpha.com/v2/query" - ) - curl "${curl_args[@]}" | \ - jq -r '.queryresult.pods[] | select(.subpods[0].plaintext != "")' -} - -eval "$(argc --argc-eval "$0" "$@")" -- cgit v1.2.3