11#! /usr/bin/env sh
2- # ----------------------------------------------------------------------------
2+ # ------------------------------------------------------------------------------
33# Licensed to the Apache Software Foundation (ASF) under one
44# or more contributor license agreements. See the NOTICE file
55# distributed with this work for additional information
1616# KIND, either express or implied. See the License for the
1717# specific language governing permissions and limitations
1818# under the License.
19- # ----------------------------------------------------------------------------
19+ # ------------------------------------------------------------------------------
2020
21- # ----------------------------------------------------------------------------
21+ # ------------------------------------------------------------------------------
2222# Hugo Wrapper (v1.0.1)
2323#
24- # Hugo Wrapper is a POSIX-style shell script act as a wrapper to download and
25- # execute Hugo binary. It can be executed in variety of Operating Systems and
26- # Command Shells. As a result, hugow has very minimal number of dependencies:
24+ # Hugo Wrapper is a POSIX-style shell script which acts as a wrapper to download
25+ # and execute Hugo binary for your platform. It can be executed in variety of
26+ # Operating Systems and Command Shells. As a result, hugow has very minimal
27+ # number of dependencies:
2728#
2829# downloader: wget or curl
2930# checksum : sha256sum or shasum or cksum
3031# tarball : tar
3132#
3233# https://github.com/khos2ow/hugo-wrapper
33- # ----------------------------------------------------------------------------
34+ # ------------------------------------------------------------------------------
3435
3536set -e
3637
@@ -124,10 +125,10 @@ if [ -z "$os_type" -o -z "$os_arch" ]; then
124125 exit 1
125126fi
126127
127- # ----------------------------------------------------------------------------
128+ # ------------------------------------------------------------------------------
128129# traverses directory structure from process work directory to filesystem root
129130# first directory with .hugo subdirectory is considered project base directory
130- # ----------------------------------------------------------------------------
131+ # ------------------------------------------------------------------------------
131132find_basedir () {
132133 if [ -z " $1 " ]; then
133134 echo " Error: Path not specified to find_basedir"
@@ -267,17 +268,17 @@ download_version() {
267268 fi
268269}
269270
270- # ----------------------------------------------------------------------------
271+ # ------------------------------------------------------------------------------
271272# upgrade hugo wrapper binary and save it as ${BASE_DIR}/hugow
272- # ----------------------------------------------------------------------------
273+ # ------------------------------------------------------------------------------
273274if [ " $version " = true ]; then
274275 echo " Hugo Wrapper $VERSION_NUMBER "
275276 exit
276277fi
277278
278- # ----------------------------------------------------------------------------
279+ # ------------------------------------------------------------------------------
279280# upgrade hugo wrapper binary and save it as ${BASE_DIR}/hugow
280- # ----------------------------------------------------------------------------
281+ # ------------------------------------------------------------------------------
281282if [ " $upgrade " = true ]; then
282283 printf " downloading hugow binary ... "
283284 $DOWNLOAD_COMMAND $DOWNLOAD_SILENT $DOWNLOAD_REDIRECT $DOWNLOAD_OUTPUT " hugow" " https://raw.githubusercontent.com/khos2ow/hugo-wrapper/master/hugow" &
@@ -287,9 +288,9 @@ if [ "$upgrade" = true ]; then
287288 exit
288289fi
289290
290- # ----------------------------------------------------------------------------
291+ # ------------------------------------------------------------------------------
291292# download hugo binary and save it as ${BASE_DIR}/.hugo/hugo
292- # ----------------------------------------------------------------------------
293+ # ------------------------------------------------------------------------------
293294if [ -r " $BASE_DIR /.hugo/hugo" ]; then
294295 current_binary_version=" $( $BASE_DIR /.hugo/hugo version | sed -ne ' s/[^0-9]*\(\([0-9]*\.\)\{0,4\}[0-9]*[^.]\).*/\1/p' | sed ' s/^ *//;s/ *$//' ) "
295296
@@ -338,17 +339,17 @@ else
338339 fi
339340fi
340341
341- # ----------------------------------------------------------------------------
342+ # ------------------------------------------------------------------------------
342343# only download binary and not execute hugo related command
343- # ----------------------------------------------------------------------------
344+ # ------------------------------------------------------------------------------
344345if [ " $get_latest " = true -o -n " $get_version " ]; then
345346 ${BASE_DIR} /.hugo/hugo version
346347 exit
347348fi
348349
349- # ----------------------------------------------------------------------------
350+ # ------------------------------------------------------------------------------
350351# Show help, both from hugow and ${BASE_DIR}/.hugo/hugo
351- # ----------------------------------------------------------------------------
352+ # ------------------------------------------------------------------------------
352353if [ $show_help = true ]; then
353354 help=$( ${BASE_DIR} /.hugo/hugo --help)
354355 cat << USAGE
@@ -373,7 +374,7 @@ USAGE
373374 exit 0
374375fi
375376
376- # ----------------------------------------------------------------------------
377+ # ------------------------------------------------------------------------------
377378# pass commands and flags to actual hugo binary
378- # ----------------------------------------------------------------------------
379+ # ------------------------------------------------------------------------------
379380${BASE_DIR} /.hugo/hugo " $@ "
0 commit comments