diff options
author | Ulrich Müller <ulm@gentoo.org> | 2009-05-19 06:26:20 +0000 |
---|---|---|
committer | Ulrich Müller <ulm@gentoo.org> | 2009-05-19 06:26:20 +0000 |
commit | cf9c7213430d7f22341c44a555fce3ca2790992b (patch) | |
tree | 77137c9eadb2cd963accf03cfa07add3a0bb945f /bin | |
parent | Update version to 1.1_rc1. (diff) | |
download | eselect-cf9c7213430d7f22341c44a555fce3ca2790992b.tar.gz eselect-cf9c7213430d7f22341c44a555fce3ca2790992b.tar.bz2 eselect-cf9c7213430d7f22341c44a555fce3ca2790992b.zip |
Use consistent indentation for all source files.
svn path=/trunk/; revision=546
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/eselect.in | 140 |
1 files changed, 67 insertions, 73 deletions
diff --git a/bin/eselect.in b/bin/eselect.in index 8973e89..ffe6966 100755 --- a/bin/eselect.in +++ b/bin/eselect.in @@ -1,6 +1,5 @@ #!/bin/bash - -# Copyright (c) 2005-2009 Gentoo Foundation. +# Copyright (c) 2005-2009 Gentoo Foundation -*-eselect-*- # $Id$ # This file is part of the 'eselect' tools framework. # @@ -24,8 +23,8 @@ ESELECT_DEFAULT_MODULES_PATH="${ESELECT_DATA_PATH}/modules" # Look in these places for modules ESELECT_MODULES_PATH=( \ - "${HOME}/.eselect/modules" \ - "${ESELECT_DEFAULT_MODULES_PATH}" ) + "${HOME}/.eselect/modules" \ + "${ESELECT_DEFAULT_MODULES_PATH}" ) # Look in this place for libraries ESELECT_CORE_PATH="${ESELECT_DATA_PATH}/libs" @@ -68,63 +67,63 @@ trap 'echo "exiting" >&2; exit 250' 15 # Find and echo the filename of the foo module. If there's no foo module, # die. ec_find_module() { - local modname="$1" modpath="" modfile="" - [[ -z ${modname} ]] && die "Usage: ${FUNCNAME} <module>" - for modpath in "${ESELECT_MODULES_PATH[@]}" ; do - [[ -f ${modpath}/${modname}.eselect ]] && break - done - - modfile="${modpath}/${modname}.eselect" - [[ -r ${modfile} ]] || die -q "Can't load module ${modname}" - echo ${modfile} + local modname="$1" modpath="" modfile="" + [[ -z ${modname} ]] && die "Usage: ${FUNCNAME} <module>" + for modpath in "${ESELECT_MODULES_PATH[@]}" ; do + [[ -f ${modpath}/${modname}.eselect ]] && break + done + + modfile="${modpath}/${modname}.eselect" + [[ -r ${modfile} ]] || die -q "Can't load module ${modname}" + echo ${modfile} } # ec_do_usage # Display eselect usage ec_do_usage() { - echo "Usage: eselect <global options> <module name> <module options>" + echo "Usage: eselect <global options> <module name> <module options>" } # ec_do_help # Display eselect help ec_do_help() { - ec_do_usage - echo - ec_do_list-options - echo - ec_do_list-modules + ec_do_usage + echo + ec_do_list-options + echo + ec_do_list-modules } # ec_do_version # Display eselect version ec_do_version() { - echo "eselect ${ESELECT_VERSION}" - echo - echo "Copyright (c) 2005-2009 Gentoo Foundation." - echo "Distributed under the terms of the GNU General Public License v2." + echo "eselect ${ESELECT_VERSION}" + echo + echo "Copyright (c) 2005-2009 Gentoo Foundation." + echo "Distributed under the terms of the GNU General Public License v2." } # ec_do_list-options # Display all recognized global options ec_do_list-options() { - write_list_start "Global options:" - write_kv_list_entry "--no-color,--no-colour" "Disable coloured output" + write_list_start "Global options:" + write_kv_list_entry "--no-color,--no-colour" "Disable coloured output" } # ec_do_list-modules # Display all available eselect modules DEPRECATED ec_do_list-modules() { - do_action modules list "$@" + do_action modules list "$@" } ### main code ### # enable colour output and get width of terminal iff stdout is a tty if [[ -t 1 ]]; then - colours - init_columns + colours + init_columns else - nocolours + nocolours fi # figure out what the action is. we need to know whether we're @@ -132,60 +131,55 @@ fi action="" for suffix in config update{,r} tool manager reader ; do - if [[ ${0%%-${suffix}} != ${0} ]] ; then - action=$(basename "${0}" ) - action=${action%%-${suffix}} - break - fi + if [[ ${0%%-${suffix}} != ${0} ]] ; then + action=$(basename "${0}" ) + action=${action%%-${suffix}} + break + fi done unset suffix if [[ -z ${action} ]] ; then - binname=$(basename "${0}" ) - for prefix in config update{,r} manage 'read' ; do - if [[ ${binname##${prefix}-} != ${binname} ]] ; then - action=$(basename "${0}" ) - action=${action##${prefix}-} - break - fi - done - unset binname prefix + binname=$(basename "${0}" ) + for prefix in config update{,r} manage 'read' ; do + if [[ ${binname##${prefix}-} != ${binname} ]] ; then + action=$(basename "${0}" ) + action=${action##${prefix}-} + break + fi + done + unset binname prefix fi if [[ -z ${action} ]] && [[ -n ${1##--} ]] ; then - while [[ ${1##--} != ${1} ]] ; do - has ${1##--} ${ESELECT_KNOWN_OPTIONS} || \ - die -q "Unknown option ${1}!" - case ${1##--} in - no-colour|no-color) - ESELECT_OPTIONS="${ESELECT_OPTIONS} NOCOLOUR" - nocolours - ;; - help|version) - action=${1##--} - ;; - esac - shift - done - if [[ -z ${action} ]]; then - action=${1} - shift - fi + while [[ ${1##--} != ${1} ]] ; do + has ${1##--} ${ESELECT_KNOWN_OPTIONS} || \ + die -q "Unknown option ${1}!" + case ${1##--} in + no-colour|no-color) + ESELECT_OPTIONS="${ESELECT_OPTIONS} NOCOLOUR" + nocolours + ;; + help|version) + action=${1##--} + ;; + esac + shift + done + if [[ -z ${action} ]]; then + action=${1} + shift + fi fi if [[ -n ${action} ]] ; then - if is_function "ec_do_${action}" ; then - ec_do_${action} "$@" - else - do_action "${action}" "$@" - fi + if is_function "ec_do_${action}" ; then + ec_do_${action} "$@" + else + do_action "${action}" "$@" + fi else - ec_do_help + ec_do_help fi -# Local Variables: -# sh-indentation: 4 -# indent-tabs-mode: nil -# End: - -# vim: set sw=4 et sts=4 tw=80 : +# vim: set ft=eselect : |