diff options
author | Ulrich Müller <ulm@gentoo.org> | 2009-04-22 22:39:23 +0000 |
---|---|---|
committer | Ulrich Müller <ulm@gentoo.org> | 2009-04-22 22:39:23 +0000 |
commit | b1fa815ac773b85cf1acca9cc0f61f0c714dd7b4 (patch) | |
tree | 946c1550eb55e1591074661aec60e50289a154b5 | |
parent | Assign the name of the module to ESELECT_MODULE_NAME, bug 220116. (diff) | |
download | eselect-b1fa815ac773b85cf1acca9cc0f61f0c714dd7b4.tar.gz eselect-b1fa815ac773b85cf1acca9cc0f61f0c714dd7b4.tar.bz2 eselect-b1fa815ac773b85cf1acca9cc0f61f0c714dd7b4.zip |
Whitespace.
svn path=/trunk/; revision=495
-rw-r--r-- | libs/editor-variable.bash.in | 164 | ||||
-rw-r--r-- | libs/manip.bash.in | 2 | ||||
-rw-r--r-- | libs/multilib.bash.in | 6 | ||||
-rw-r--r-- | libs/package-manager.bash.in | 1 |
4 files changed, 86 insertions, 87 deletions
diff --git a/libs/editor-variable.bash.in b/libs/editor-variable.bash.in index e2efef9..661ea69 100644 --- a/libs/editor-variable.bash.in +++ b/libs/editor-variable.bash.in @@ -31,139 +31,139 @@ inherit config # find a list of valid targets find_targets() { - local cur targets i - targets=${EDITOR_LIST} - cur=$(read_env_value) + local cur targets i + targets=${EDITOR_LIST} + cur=$(read_env_value) - # also include the current value if it's not already in our list - [[ -n ${cur} ]] && ! has "${cur}" ${targets} \ - && targets="${targets} ${cur}" + # also include the current value if it's not already in our list + [[ -n ${cur} ]] && ! has "${cur}" ${targets} \ + && targets="${targets} ${cur}" - for i in ${targets}; do - [[ -f ${ROOT}${i} ]] && echo "${i}" - done + for i in ${targets}; do + [[ -f ${ROOT}${i} ]] && echo "${i}" + done } # read variable value from config file read_env_value() { - load_config "${ROOT}${EDITOR_ENVFILE}" "${EDITOR_VAR}" + load_config "${ROOT}${EDITOR_ENVFILE}" "${EDITOR_VAR}" } # write variable to config file write_env_value() { - [[ -w ${ROOT}${EDITOR_ENVFILE%/*} ]] \ - || die -q "You need root privileges!" - store_config "${ROOT}${EDITOR_ENVFILE}" "${EDITOR_VAR}" "$1" + [[ -w ${ROOT}${EDITOR_ENVFILE%/*} ]] \ + || die -q "You need root privileges!" + store_config "${ROOT}${EDITOR_ENVFILE}" "${EDITOR_VAR}" "$1" } ### show action ### describe_show() { - echo "Show value of the ${EDITOR_VAR} variable in profile" + echo "Show value of the ${EDITOR_VAR} variable in profile" } do_show() { - [[ $# -gt 0 ]] && die -q "Too many parameters" + [[ $# -gt 0 ]] && die -q "Too many parameters" - local cur=$(read_env_value) - write_list_start "${EDITOR_VAR} variable in profile:" - write_kv_list_entry "${cur:-(none)}" + local cur=$(read_env_value) + write_list_start "${EDITOR_VAR} variable in profile:" + write_kv_list_entry "${cur:-(none)}" } ### list action ### describe_list() { - echo "List available targets for the ${EDITOR_VAR} variable" + echo "List available targets for the ${EDITOR_VAR} variable" } do_list() { - [[ $# -gt 0 ]] && die -q "Too many parameters" - - local cur targets i - cur=$(read_env_value) - targets=( $(find_targets) ) - - write_list_start "Available targets for the ${EDITOR_VAR} variable:" - if [[ -n ${targets[@]} ]]; then - for (( i = 0; i < ${#targets[@]}; i = i + 1 )); do - # Display a star to indicate the currently chosen version - [[ ${targets[i]} = ${cur} ]] \ - && targets[i]="${targets[i]} $(highlight '*')" - done - write_numbered_list "${targets[@]}" - fi - write_numbered_list_entry " " "(free form)" + [[ $# -gt 0 ]] && die -q "Too many parameters" + + local cur targets i + cur=$(read_env_value) + targets=( $(find_targets) ) + + write_list_start "Available targets for the ${EDITOR_VAR} variable:" + if [[ -n ${targets[@]} ]]; then + for (( i = 0; i < ${#targets[@]}; i = i + 1 )); do + # Display a star to indicate the currently chosen version + [[ ${targets[i]} = ${cur} ]] \ + && targets[i]="${targets[i]} $(highlight '*')" + done + write_numbered_list "${targets[@]}" + fi + write_numbered_list_entry " " "(free form)" } ### set action ### describe_set() { - echo "Set the ${EDITOR_VAR} variable in profile" + echo "Set the ${EDITOR_VAR} variable in profile" } describe_set_options() { - echo "target : Target name or number (from 'list' action)" + echo "target : Target name or number (from 'list' action)" } describe_set_parameters() { - echo "<target>" + echo "<target>" } do_set() { - [[ -z $1 ]] && die -q "You didn't tell me what to set the variable to" - [[ $# -gt 1 ]] && die -q "Too many parameters" - - local target=$1 targets dir ifs_save=${IFS-$' \t\n'} - - # target may be specified by its name or its index - if is_number "${target}"; then - targets=( $(find_targets) ) - [[ ${target} -ge 1 && ${target} -le ${#targets[@]} ]] \ - || die -q "Number out of range: $1" - target=${targets[target-1]} - fi - - # is the target an absolute path? if not, try to find it - if [[ -n ${target##/*} ]]; then - IFS=: - for dir in ${EDITOR_PATH-/bin:/usr/bin}; do - [[ -f ${ROOT}${dir}/${target} ]] || continue - target=${dir}/${target} - break - done - IFS=${ifs_save} - fi - - # we should now have a path to an existing binary - [[ -z ${target##/*} && -f ${ROOT}${target} ]] \ - || die -q "Target \"${target}\" doesn't appear to be valid!" - - echo "Setting ${EDITOR_VAR} to ${target} ..." - write_env_value "${target}" - - # update profile - do_action env update noldconfig + [[ -z $1 ]] && die -q "You didn't tell me what to set the variable to" + [[ $# -gt 1 ]] && die -q "Too many parameters" + + local target=$1 targets dir ifs_save=${IFS-$' \t\n'} + + # target may be specified by its name or its index + if is_number "${target}"; then + targets=( $(find_targets) ) + [[ ${target} -ge 1 && ${target} -le ${#targets[@]} ]] \ + || die -q "Number out of range: $1" + target=${targets[target-1]} + fi + + # is the target an absolute path? if not, try to find it + if [[ -n ${target##/*} ]]; then + IFS=: + for dir in ${EDITOR_PATH-/bin:/usr/bin}; do + [[ -f ${ROOT}${dir}/${target} ]] || continue + target=${dir}/${target} + break + done + IFS=${ifs_save} + fi + + # we should now have a path to an existing binary + [[ -z ${target##/*} && -f ${ROOT}${target} ]] \ + || die -q "Target \"${target}\" doesn't appear to be valid!" + + echo "Setting ${EDITOR_VAR} to ${target} ..." + write_env_value "${target}" + + # update profile + do_action env update noldconfig } ### update action ### describe_update() { - echo "Update the ${EDITOR_VAR} variable if it is unset or invalid" + echo "Update the ${EDITOR_VAR} variable if it is unset or invalid" } do_update() { - [[ $# -gt 0 ]] && die -q "Too many parameters" + [[ $# -gt 0 ]] && die -q "Too many parameters" - local cur targets - cur=$(read_env_value) - [[ -n ${cur} && -f ${ROOT}${cur} ]] && return + local cur targets + cur=$(read_env_value) + [[ -n ${cur} && -f ${ROOT}${cur} ]] && return - targets=( $(find_targets) ) - [[ ${#targets[@]} -gt 0 ]] \ - || die -q "No valid target for ${EDITOR_VAR} found" + targets=( $(find_targets) ) + [[ ${#targets[@]} -gt 0 ]] \ + || die -q "No valid target for ${EDITOR_VAR} found" - echo "Setting ${EDITOR_VAR} to ${targets[0]} ..." - write_env_value "${targets[0]}" + echo "Setting ${EDITOR_VAR} to ${targets[0]} ..." + write_env_value "${targets[0]}" - do_action env update noldconfig + do_action env update noldconfig } diff --git a/libs/manip.bash.in b/libs/manip.bash.in index 51f4b9a..597d979 100644 --- a/libs/manip.bash.in +++ b/libs/manip.bash.in @@ -29,5 +29,3 @@ svn_date_to_version() { } # vim: set sw=4 et sts=4 tw=80 : - - diff --git a/libs/multilib.bash.in b/libs/multilib.bash.in index 9f82ff5..9bce486 100644 --- a/libs/multilib.bash.in +++ b/libs/multilib.bash.in @@ -29,9 +29,9 @@ list_libdirs() { fi done if [[ -z ${libdirs[@]} ]] ; then - # Broken or non-existing ld.so.conf - libdirs=( ${ROOT}/lib* ) - libdirs=( ${libdirs[@]/\/lib/lib} ) + # Broken or non-existing ld.so.conf + libdirs=( ${ROOT}/lib* ) + libdirs=( ${libdirs[@]/\/lib/lib} ) fi echo "${libdirs[@]}" } diff --git a/libs/package-manager.bash.in b/libs/package-manager.bash.in index 194c1c5..c027c8a 100644 --- a/libs/package-manager.bash.in +++ b/libs/package-manager.bash.in @@ -172,4 +172,5 @@ package-manager() { echo ${manager} export ESELECT_PACKAGE_MANAGER_CACHE=${manager} } + # vim: set sw=4 et sts=4 tw=80 : |