Skip to content

Commit

Permalink
Refactor code duplication
Browse files Browse the repository at this point in the history
Reuse utilities instead of duplicating function
  • Loading branch information
undergroundwires committed Mar 2, 2022
1 parent d73f1b5 commit 6c2963d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions scripts/shared/log-commits.sh
Expand Up @@ -12,6 +12,13 @@
# Dependencies:
# - External: git

# Globals
readonly SCRIPT_DIRECTORY=$(dirname "$0")

# Import dependencies
# shellcheck source=utilities.sh
source "$SCRIPT_DIRECTORY/utilities.sh"

# Parse parameters
while [[ "$#" -gt 0 ]]; do case $1 in
--current) CURRENT="$2"; shift;;
Expand All @@ -20,8 +27,6 @@ while [[ "$#" -gt 0 ]]; do case $1 in
*) echo "Unknown parameter passed: $1"; exit 1;;
esac; shift; done

utilities::is_empty_or_null() { local -r text="$1"; [[ -z "$text" ]]; }

# Validate parameters
if utilities::is_empty_or_null "$CURRENT"; then echo "Current tag is missing"; exit 1; fi;
if utilities::is_empty_or_null "$PREVIOUS"; then echo "Previous tag is missing"; exit 1; fi;
Expand Down

0 comments on commit 6c2963d

Please sign in to comment.