Ignore:
Timestamp:
Dec 18, 2011, 10:58:10 AM (9 years ago)
Author:
g7moreau
Message:
  • Rename list -> avail (like module)
  • Add command list -> load bundle
  • Add command status
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bundle/bundle.bash

    r53 r54  
    44
    55   case "$1" in
    6       list)
     6      avail)
    77          [ -d "/etc/bundle/bundle.d" ]   && ( cd "/etc/loadenv.d" ; find . -type f -a -name "*.${ext}" | sed -e "s/.\///; s/\.${ext}\$/" )
    88          [ -d "${HOME}/.config/loadenv" ] && ( cd "${HOME}/.config/loadenv" ; find . -type f -a -name "*.${ext}" | sed -e "s/.\///; s/\.${ext}\$//" )
     
    1616            let _bundle_level++
    1717            export _bundle_level
     18            export _bundle_status="${_bundle_status}:$2"
    1819            $VERBOSE && echo "Begin bundle: ${_bundle_name}"
    1920            ${SHELL} --rcfile ${pack}
     
    2223            let _bundle_level--
    2324            [ ${_bundle_level} -eq 0 ] && unset _bundle_level
     25            export _bundle_status=$(echo "${_bundle_status}" | sed 's/:[^:]*$//')
     26            [ "${_bundle_status}" == "" ] && unset _bundle_status
    2427         else
    2528            echo "unable to load bundle file: $2"
     
    3740         ;;
    3841
     42      list)
     43         if [ ${_bundle_level} > 0 ]
     44         then
     45            echo "${_bundle_status}" | sed 's/^://'
     46         else
     47            echo "Error: not a bundle environment!"
     48         fi
     49         ;;
     50
     51      status)
     52         if [ ${_bundle_level} > 0 ]
     53         then
     54            echo "bundle environment active"
     55         else
     56            echo "not a bundle environment"
     57         fi
     58         ;;
     59
    3960      source)
    4061         pack=$(find ${folder} -type f -a -name "*.${ext}" -print0 2> /dev/null | grep -FzZ "/$2.${ext}" | head -n 1 )
     
    4869
    4970      *)
    50          echo "Usage: bundle list|load|unload|source|help"
     71         echo "Usage: bundle list|avail|load|unload|status|source|help"
    5172         ;;
    5273   esac
Note: See TracChangeset for help on using the changeset viewer.