Skip to content

Commit

Permalink
misc: Simplify alias functions in README
Browse files Browse the repository at this point in the history
  • Loading branch information
jmooring authored Sep 10, 2023
1 parent bbceddc commit 89a4d79
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,17 @@ valid .hvm file exists in the current directory.
```zsh
# Hugo Version Manager: override path to the hugo executable.
hugo() {
hvm_common_msg="Run 'hvm use' to fix or 'hvm disable' to disable version management."
if [ -f ".hvm" ]; then
hugo_bin=$(cat ".hvm" 2> /dev/null)
if [ -z "$hugo_bin" ]; then
>&2 printf "The .hvm file in this directory is empty.\\n"
>&2 printf "Run 'hvm use' or remove the .hvm file from this directory.\\n"
return 1
fi
if ! echo "${hugo_bin}" | grep -q "hugo$"; then
>&2 printf "The .hvm file in this directory is invalid.\\n"
>&2 printf "Run 'hvm use' or remove the .hvm file from this directory.\\n"
>&2 printf "%s\\n" "${hvm_common_msg}"
return 1
fi
if [ ! -f "${hugo_bin}" ]; then
>&2 printf "Unable to find %s.\\n" "${hugo_bin}"
>&2 printf "Run 'hvm use' or remove the .hvm file from this directory.\\n"
>&2 printf "%s\\n" "${hvm_common_msg}"
return 1
fi
else
Expand All @@ -84,21 +80,17 @@ hugo() {
```bash
# Hugo Version Manager: override path to the hugo executable.
hugo() {
hvm_common_msg="Run 'hvm use' to fix or 'hvm disable' to disable version management."
if [ -f ".hvm" ]; then
hugo_bin=$(cat ".hvm" 2> /dev/null)
if [ -z "$hugo_bin" ]; then
>&2 printf "The .hvm file in this directory is empty.\\n"
>&2 printf "Run 'hvm use' or remove the .hvm file from this directory.\\n"
return 1
fi
if ! echo "${hugo_bin}" | grep -q "hugo$"; then
>&2 printf "The .hvm file in this directory is invalid.\\n"
>&2 printf "Run 'hvm use' or remove the .hvm file from this directory.\\n"
>&2 printf "%s\\n" "${hvm_common_msg}"
return 1
fi
if [ ! -f "${hugo_bin}" ]; then
>&2 printf "Unable to find %s.\\n" "${hugo_bin}"
>&2 printf "Run 'hvm use' or remove the .hvm file from this directory.\\n"
>&2 printf "%s\\n" "${hvm_common_msg}"
return 1
fi
else
Expand Down

0 comments on commit 89a4d79

Please sign in to comment.