Skip to content

Commit f28dcf6

Browse files
authored
Cosmetic cleanup (#30)
1 parent 76f6012 commit f28dcf6

File tree

3 files changed

+47
-45
lines changed

3 files changed

+47
-45
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ The universal way to include Hugo binary to your project.
44

55
## Hugo Wrapper dependencies
66

7-
`hugow` is a POSIX-style shell script act as a wrapper of [Hugo](https://gohugo.io/)
8-
binary which is, in fact, [platform dependent](https://gohugo.io/getting-started/installing/#binary-cross-platform).
9-
It can be executed in variety of [Operating Systems](#tested-on) and
7+
`hugow` is a POSIX-style shell script which acts as a wrapper to download and run [Hugo](https://gohugo.io/)
8+
binary - which is, in fact, [platform dependent](https://gohugo.io/getting-started/installing/#binary-cross-platform) -
9+
for your platform. It can be executed in variety of [Operating Systems](#tested-on) and
1010
[Command Shells](#tested-on). As a result, `hugow` has very minimal number of
1111
dependencies:
1212

example/hugow

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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
@@ -16,21 +16,22 @@
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

3536
set -e
3637

@@ -124,10 +125,10 @@ if [ -z "$os_type" -o -z "$os_arch" ]; then
124125
exit 1
125126
fi
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+
# ------------------------------------------------------------------------------
131132
find_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+
# ------------------------------------------------------------------------------
273274
if [ "$version" = true ]; then
274275
echo "Hugo Wrapper $VERSION_NUMBER"
275276
exit
276277
fi
277278

278-
# ----------------------------------------------------------------------------
279+
# ------------------------------------------------------------------------------
279280
# upgrade hugo wrapper binary and save it as ${BASE_DIR}/hugow
280-
# ----------------------------------------------------------------------------
281+
# ------------------------------------------------------------------------------
281282
if [ "$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
288289
fi
289290

290-
# ----------------------------------------------------------------------------
291+
# ------------------------------------------------------------------------------
291292
# download hugo binary and save it as ${BASE_DIR}/.hugo/hugo
292-
# ----------------------------------------------------------------------------
293+
# ------------------------------------------------------------------------------
293294
if [ -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
339340
fi
340341

341-
# ----------------------------------------------------------------------------
342+
# ------------------------------------------------------------------------------
342343
# only download binary and not execute hugo related command
343-
# ----------------------------------------------------------------------------
344+
# ------------------------------------------------------------------------------
344345
if [ "$get_latest" = true -o -n "$get_version" ]; then
345346
${BASE_DIR}/.hugo/hugo version
346347
exit
347348
fi
348349

349-
# ----------------------------------------------------------------------------
350+
# ------------------------------------------------------------------------------
350351
# Show help, both from hugow and ${BASE_DIR}/.hugo/hugo
351-
# ----------------------------------------------------------------------------
352+
# ------------------------------------------------------------------------------
352353
if [ $show_help = true ]; then
353354
help=$(${BASE_DIR}/.hugo/hugo --help)
354355
cat << USAGE
@@ -373,7 +374,7 @@ USAGE
373374
exit 0
374375
fi
375376

376-
# ----------------------------------------------------------------------------
377+
# ------------------------------------------------------------------------------
377378
# pass commands and flags to actual hugo binary
378-
# ----------------------------------------------------------------------------
379+
# ------------------------------------------------------------------------------
379380
${BASE_DIR}/.hugo/hugo "$@"

hugow

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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
@@ -16,21 +16,22 @@
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

3536
set -e
3637

@@ -124,10 +125,10 @@ if [ -z "$os_type" -o -z "$os_arch" ]; then
124125
exit 1
125126
fi
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+
# ------------------------------------------------------------------------------
131132
find_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+
# ------------------------------------------------------------------------------
273274
if [ "$version" = true ]; then
274275
echo "Hugo Wrapper $VERSION_NUMBER"
275276
exit
276277
fi
277278

278-
# ----------------------------------------------------------------------------
279+
# ------------------------------------------------------------------------------
279280
# upgrade hugo wrapper binary and save it as ${BASE_DIR}/hugow
280-
# ----------------------------------------------------------------------------
281+
# ------------------------------------------------------------------------------
281282
if [ "$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
288289
fi
289290

290-
# ----------------------------------------------------------------------------
291+
# ------------------------------------------------------------------------------
291292
# download hugo binary and save it as ${BASE_DIR}/.hugo/hugo
292-
# ----------------------------------------------------------------------------
293+
# ------------------------------------------------------------------------------
293294
if [ -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
339340
fi
340341

341-
# ----------------------------------------------------------------------------
342+
# ------------------------------------------------------------------------------
342343
# only download binary and not execute hugo related command
343-
# ----------------------------------------------------------------------------
344+
# ------------------------------------------------------------------------------
344345
if [ "$get_latest" = true -o -n "$get_version" ]; then
345346
${BASE_DIR}/.hugo/hugo version
346347
exit
347348
fi
348349

349-
# ----------------------------------------------------------------------------
350+
# ------------------------------------------------------------------------------
350351
# Show help, both from hugow and ${BASE_DIR}/.hugo/hugo
351-
# ----------------------------------------------------------------------------
352+
# ------------------------------------------------------------------------------
352353
if [ $show_help = true ]; then
353354
help=$(${BASE_DIR}/.hugo/hugo --help)
354355
cat << USAGE
@@ -373,7 +374,7 @@ USAGE
373374
exit 0
374375
fi
375376

376-
# ----------------------------------------------------------------------------
377+
# ------------------------------------------------------------------------------
377378
# pass commands and flags to actual hugo binary
378-
# ----------------------------------------------------------------------------
379+
# ------------------------------------------------------------------------------
379380
${BASE_DIR}/.hugo/hugo "$@"

0 commit comments

Comments
 (0)