#!/bin/bash
# w4 - wget helper

set -e

source "/home/zwelch/src/mcf/mcsh-release/install/share/mcsh/mcsh.sh"

lib_load 'net/tool/wget'
lib_load 'doc/tool/wkhtmltopdf'
#lib_load 'doc/pdf'


######
# Mirroring CLI

w4_mirror() { cmd_dispatch "$@"; }
w4_mirror_usage() {
	cat <<EOF
<cmd> ...
Mirroring Commands:
	fetch <url>			Mirror a site, starting at url.
	convert <path>			Convert a site to PDF files.
EOF
}

w4_mirror_fetch() {
	min_args 1 "$@"
	local wget_prefix=${2:-/}
	local wget_host_dirs=false
	wget_mirror "$1"
}

w4_mirror_convert() {
	min_args 1 "$@"
	local -a file_find_opts=( -name '*.html' )
	local -a pdfs
	file_find pdfs "$@"
	html_to_pdf_wk "${pdfs[@]}"
}

######
# Hosted Tools

w4_run() { wget_exec "$@"; }


######
# Check

# w4_check() - Downloads and executes a
w4_check() {
	local url="https://downloads.mandolincreek.net/pub/systems/mcsh/tests"
	w4_run "$url/hello.sh?version=$package_version"
}


######
# Main

w4_desc() { echo "wget helper"; }

w4_usage() {
	cat <<EOF
<cmd> ...
Web Download Commands:
	run <url> [<args>]		Downloads a file and executes it
	mirror ...			Website mirroring
EOF
}

app_run "$@"

View the Developer Guide Index

View the Reference Manual Index


Generated on Fri Jul 28 14:34:39 PDT 2017 by mcsh d14 v0.23.0.