diff --git a/README.markdown b/README.markdown index d6bc0af..ba688e9 100644 --- a/README.markdown +++ b/README.markdown @@ -609,6 +609,13 @@ Completely tear down and remove one or more Composer projects: lec remove # Choose one or more projects to remove ``` +List various entities + +```sh +lec list # Displays entities that can be listed; `lec list ` lists all entries of the selected entity. +lec list releases # Displays all releases. +``` + Jump to a workspace: ```sh diff --git a/scripts/cli/lec.sh b/scripts/cli/lec.sh index 62d20e7..c48064b 100755 --- a/scripts/cli/lec.sh +++ b/scripts/cli/lec.sh @@ -112,6 +112,7 @@ _printHelpAndExit() { stop Stop a Composer project clean Stop a Composer project and remove Docker volumes exportData Export container data for a Composer project + list List entities of a various types remove Completely tear down and remove one or more Composer projects share [--export] Save a Composer workspace for sharing. The "--export" flag exports the container data before saving the workspace. update [--unstable] Check for updates to Composer and lec. The "--unstable" flag updates to latest master branch. @@ -533,34 +534,6 @@ _cmd_gw() { ./gradlew "${@}" ) } -_cmd_list() { - local closest_entity - local entity="${1}" - - if [[ -z "${entity}" ]]; then - _print_step "Showing listable entities..." - - _listPrefixedFunctions _list_ - - exit - fi - - if ! _verifyListableEntity "${entity}"; then - closest_entity=$(_listPrefixedFunctions _list_| _fzf --filter "${entity}" | head -n 1) - - if _verifyListableEntity "${closest_entity}" && _confirm "Entity \"${entity}\" is unknown. Use closest entity \"${closest_entity}\" instead?"; then - entity=${closest_entity} - else - _print_error "Cannot list ${C_YELLOW}${entity}${C_NC}. Showing listable entities..." - - _listPrefixedFunctions _list_ - - exit - fi - fi - - _list_"${entity}" -} _cmd_ports() { local serviceName="${1}" @@ -721,6 +694,34 @@ cmd_init() { _print_success "Created new Liferay Environment Composer project at ${C_BLUE}${worktree_dir}${C_NC}" } +cmd_list() { + local closest_entity + local entity="${1}" + + if [[ -z "${entity}" ]]; then + _print_step "Showing listable entities..." + + _listPrefixedFunctions _list_ + + exit + fi + + if ! _verifyListableEntity "${entity}"; then + closest_entity=$(_listPrefixedFunctions _list_| _fzf --filter "${entity}" | head -n 1) + + if _verifyListableEntity "${closest_entity}" && _confirm "Entity \"${entity}\" is unknown. Use closest entity \"${closest_entity}\" instead?"; then + entity=${closest_entity} + else + _print_error "Cannot list ${C_YELLOW}${entity}${C_NC}. Showing listable entities..." + + _listPrefixedFunctions _list_ + + exit + fi + fi + + _list_"${entity}" +} cmd_remove() { local worktrees worktrees="$(_listWorktrees | grep -E -v "^${LIFERAY_ENVIRONMENT_COMPOSER_HOME}$" | _selectMultiple "Choose projects to remove (Tab to select multiple)")"