From cc35918fe2995ccebec2b05a8ed4064c15d414ea Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Thu, 19 May 2022 20:52:29 +0000 Subject: tests: add a fake wget so we can simulate fetching things from internet --- tests/bin/wget | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100755 tests/bin/wget (limited to 'tests/bin') diff --git a/tests/bin/wget b/tests/bin/wget new file mode 100755 index 0000000..72306a4 --- /dev/null +++ b/tests/bin/wget @@ -0,0 +1,75 @@ +#!/bin/sh + +prog=${0##*/} +usage() { + cat <&2 + fi +} + +OPTS=$(getopt -l quiet,help,spider -o "qhO:" -n $prog -- "$@") || usage "1" >&2 + +quiet= +eval set -- "$OPTS" +while true; do + opt="$1" + case "$opt" in + -h|--help) + usage 0 + ;; + -q|--quiet) + quiet=1 + ;; + --spider) + exit ${SPIDER_STATUS:-0} + ;; + -O) + shift + outfile="$1" + ;; + --) + shift + break + ;; + *) usage "1" >&2 + ;; + esac + shift +done + +: ${outfile:=index.html} +case "$outfile" in + -) msg "writing to stdout" + echo "$WGETCONTENT" + ;; + *) msg "saving to '$outfile'" + echo "$WGETCONTENT" > "$outfile" + ;; +esac + -- cgit v1.2.3