refactor: improve code quality

This commit is contained in:
sigoden
2024-07-06 02:45:39 +00:00
parent 02067cd913
commit 9e23134b7c
2 changed files with 6 additions and 5 deletions
+5 -4
View File
@@ -1,14 +1,15 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -e
# @describe Fetches the HTML content from a specified webpage URL and converts it to Markdown format. # @describe Get the contents from a URL.
# Use it to answer user questions that require up-to-date content from web pages. # @meta require-tools pandoc
# @meta require-tools curl,pandoc,sed
# @option --url! The URL to scrape. # @option --url! The URL to scrape.
main() { main() {
# span and div tags are dropped from the HTML https://pandoc.org/MANUAL.html#raw-htmltex and sed removes any inline SVG images in image tags from the Markdown content. # span and div tags are dropped from the HTML https://pandoc.org/MANUAL.html#raw-htmltex and sed removes any inline SVG images in image tags from the Markdown content.
curl -fsSL "$argc_url" | pandoc -f html-native_divs-native_spans -t gfm-raw_html | sed -E 's/!\[.*?\]\((data:image\/svg\+xml[^)]+)\)//g' curl -fsSL "$argc_url" | \
pandoc -f html-native_divs-native_spans -t gfm-raw_html | \
sed -E 's/!\[.*?\]\((data:image\/svg\+xml[^)]+)\)//g'
} }
eval "$(argc --argc-eval "$0" "$@")" eval "$(argc --argc-eval "$0" "$@")"
+1 -1
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -e
# @describe Searche Wikipedia for a query. # @describe Search Wikipedia for a query.
# Uses it to get detailed information about a public figure, interpretation of a complex scientific concept or in-depth connectivity of a significant historical event,. # Uses it to get detailed information about a public figure, interpretation of a complex scientific concept or in-depth connectivity of a significant historical event,.
# @option --query! The query to search for. # @option --query! The query to search for.