summary refs log tree commit diff stats
path: root/examples/bash_subshell_notice.sh
blob: b6b03d745102cc004ce1ac1826e5ab61a9787f72 (plain) (blame)
1
2
3
4
5
# Change the prompt when you open a shell from inside ranger
#
# Add this line to your .bashrc for it to work.

[ -n "$RANGER_LEVEL" ] && PS1="$PS1"'(in ranger) '
2 03:27:58 +0100 committer hut <hut@lavabit.com> 2013-02-22 03:27:58 +0100 use 4-space-indents in files that had 2-space-indents' href='/akspecs/ranger/commit/ranger/ext/cached_function.py?h=v1.9.3&id=d894fd02f52c569cfcf73917a006d68513af56ff'>d894fd02 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

                                                                 
 
                                                                  
 
 
                         
              
 


                                     
                        


                               
                                                                            
                                
# This file is part of ranger, the console file manager.
# License: GNU GPL version 3, see the file "AUTHORS" for details.

from __future__ import (absolute_import, division, print_function)


def cached_function(fnc):
    cache = {}

    def inner_cached_function(*args):
        try:
            return cache[args]
        except KeyError:
            value = fnc(*args)
            cache[args] = value
            return value
    inner_cached_function._cache = cache  # pylint: disable=protected-access
    return inner_cached_function