Skip to content

Commit c45e700

Browse files
committed
LPD-73748 lec.sh: applies arg parsing pattern to the update command
1 parent 244613a commit c45e700

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

scripts/cli/lec.sh

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,19 @@ cmd_update() {
877877
local remote
878878
local tag_branch
879879
local upstream_repo_owner=liferay
880-
local unstable_flag="${1}"
880+
881+
local FLAG_UNSTABLE=0
882+
883+
while [[ $# -gt 0 ]]; do
884+
case "${1}" in
885+
--unstable)
886+
shift && FLAG_UNSTABLE=1
887+
;;
888+
*)
889+
shift
890+
;;
891+
esac
892+
done
881893

882894
remote="$(_git remote -v | grep "\b${upstream_repo_owner}/liferay-environment-composer\b" | grep -F '(fetch)' | awk '{print $1}' | head -n1)"
883895
if [[ -z "${remote}" ]]; then
@@ -904,7 +916,7 @@ cmd_update() {
904916

905917
_print_step "Checking for updates..."
906918

907-
if [[ "${unstable_flag}" == "--unstable" ]]; then
919+
if [[ "${FLAG_UNSTABLE}" -gt 0 ]]; then
908920
_git fetch "${remote}" master
909921

910922
if ! _git rebase "${remote}/master" master; then

0 commit comments

Comments
 (0)