Skip to content

Commit a849512

Browse files
committed
refactor(shell): drop project_open theme target and redundant targets guard
1 parent de95141 commit a849512

1 file changed

Lines changed: 4 additions & 16 deletions

File tree

shell/aliases

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ project_open() {
364364
tmux rename-window "${1}"
365365
fi
366366

367-
if [ -n "${2}" ] && [[ "${2}" != "theme" ]]; then
367+
if [ -n "${2}" ]; then
368368
# shellcheck disable=SC2164
369369
cd "${NEW_PATH}/${2}"
370370
return
@@ -376,20 +376,8 @@ project_open() {
376376
NEW_PATH="${NEW_PATH}/site"
377377
fi
378378

379-
if [ -z "${2}" ]; then
380-
# shellcheck disable=SC2164
381-
cd "${NEW_PATH}"
382-
return
383-
fi
384-
385-
THEME_PATH="$(find "${NEW_PATH}/web/app/themes" -mindepth 2 -maxdepth 2 -type f -name composer.json 2>/dev/null | LC_ALL=C sort | head -n1)"
386-
THEME_PATH="${THEME_PATH%composer.json}"
387-
if [ -z "${THEME_PATH}" ]; then
388-
echo "No theme available" >&2
389-
return 1
390-
fi
391-
392-
cd "${THEME_PATH}" || return
379+
# shellcheck disable=SC2164
380+
cd "${NEW_PATH}"
393381
}
394382
alias po='project_open'
395383

@@ -403,7 +391,7 @@ _project_open_projects() {
403391
_project_open_targets() {
404392
local name="${1}" project_path target_dir
405393
[[ -n "${name}" ]] || return 0
406-
project_path="$(_project_open_resolve "${name}" cache_only)" || return 0
394+
project_path="$(_project_open_resolve "${name}" cache_only)"
407395
[[ -n "${project_path}" ]] || return 0
408396
find "${project_path}" -mindepth 1 -maxdepth 1 -type d -not -name '.*' 2>/dev/null | while IFS= read -r target_dir; do
409397
printf '%s\n' "${target_dir##*/}"

0 commit comments

Comments
 (0)