OpenPKG CVS Repository
  http://cvs.openpkg.org/
  ____________________________________________________________________________

  Server: cvs.openpkg.org                  Name:   Ralf S. Engelschall
  Root:   /e/openpkg/cvs                   Email:  [EMAIL PROTECTED]
  Module: openpkg-re                       Date:   10-Oct-2003 20:07:44
  Branch: HEAD                             Handle: 2003101019074400

  Modified files:
    openpkg-re              openpkg-dev

  Log:
    Ok, finally commit my "cd -" and "cd +" patches. This allows you to go
    back arbitrary directory steps (not just a single one as the usual "cd
    -" does) and even allows you to undo the going back with "cd +" in case
    you went back too much. This is a very convinient functionality
    if you have to switch forth and back between directories.

  Summary:
    Revision    Changes     Path
    1.144       +38 -7      openpkg-re/openpkg-dev
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: openpkg-re/openpkg-dev
  ============================================================================
  $ cvs diff -u -r1.143 -r1.144 openpkg-dev
  --- openpkg-re/openpkg-dev    2 Oct 2003 14:41:00 -0000       1.143
  +++ openpkg-re/openpkg-dev    10 Oct 2003 18:07:44 -0000      1.144
  @@ -672,17 +672,48 @@
       }
   
       #   prompt to indicate openpkg-dev bash environment
  +    declare -a DIRSTACKREV=()
       cd () {
  -        if [ ".\$1" = . ]; then
  -            if [ ".\${OPENPKG_SPEC}" = . ]; then
  -                workdir="\${OPENPKG_WORK}"
  +        if [ ".\$1" = .- ]; then
  +            #   go to previous working directory on forward directory stack
  +            #   and move this directory onto the reverse directory stack
  +            if [ \${#DIRSTACK[*]} -gt 1 ]; then
  +                workdir="\${DIRSTACK[0]}"
  +                DIRSTACKREV[\${#DIRSTACKREV[*]}]="\${workdir}"
  +                popd >/dev/null
  +            else
  +                echo "cd: no more previous working directories on forward directory 
stack" 1>&2
  +                return 1
  +            fi
  +        elif [ ".\$1" = .+ ]; then
  +            #   go to previous working directory on reverse directory stack
  +            #   and move this directory onto the forward directory stack
  +            if [ \${#DIRSTACKREV[*]} -gt 0 ]; then
  +                local i=\$((\${#DIRSTACKREV[*]} - 1))
  +                eval "pushd \${DIRSTACKREV[\$i]} >/dev/null"
  +                unset DIRSTACKREV[\$i]
               else
  -                workdir="\`command \${OPENPKG_WORK}/re/openpkg-dev package -query 
workdir \${OPENPKG_SPEC}\`"
  +                echo "cd: no more previous working directories on reverse directory 
stack" 1>&2
  +                return 1
               fi
           else
  -            workdir="\$1"
  +            #   go to next working directory
  +            #   and move this directory onto the forward directory stack
  +            if [ ".\$1" = . ]; then
  +                if [ ".\${OPENPKG_SPEC}" = . ]; then
  +                    workdir="\${OPENPKG_WORK}"
  +                else
  +                    workdir="\`command \${OPENPKG_WORK}/re/openpkg-dev package 
-query workdir \${OPENPKG_SPEC}\`"
  +                fi
  +            else
  +                workdir="\$1"
  +            fi
  +            pushd \${workdir} >/dev/null
  +            if [ \${#DIRSTACK[*]} -ge 2 -a \${DIRSTACK[0]} = \${DIRSTACK[1]} ]; then
  +                popd >/dev/null
  +            fi
  +            DIRSTACKREV=()
           fi
  -        builtin cd \${workdir}
   
           P=\`command \${OPENPKG_WORK}/re/openpkg-dev package\`
           # P holds detection
  @@ -779,7 +810,7 @@
               fi
           fi
           # E has ultimate content
  -        
  +
           CD_FUNC_IX=""
           if [ ".\$CD_FUNC_PX" != . ]; then
               CD_FUNC_IX="\${CD_FUNC_IX}\${CD_FUNC_IX:+ }\${CD_FUNC_PX}"
  @@ .
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
CVS Repository Commit List                     [EMAIL PROTECTED]

Reply via email to