Shell-specific caches
This commit is contained in:
		
							parent
							
								
									3d8f3381c6
								
							
						
					
					
						commit
						9b9d75acc4
					
				| 
						 | 
					@ -20,7 +20,7 @@ cache() {
 | 
				
			||||||
    [[ ! -d "$CACHE_DIR" ]] && mkdir -p "$CACHE_DIR"
 | 
					    [[ ! -d "$CACHE_DIR" ]] && mkdir -p "$CACHE_DIR"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    is-callable "$1" || return 1
 | 
					    is-callable "$1" || return 1
 | 
				
			||||||
    local cache="${CACHE_DIR}/$1"
 | 
					    local cache="${CACHE_DIR}/$1-$(basename $SHELL)"
 | 
				
			||||||
    if ! [[ -f "$cache" && -s "$cache" ]]; then
 | 
					    if ! [[ -f "$cache" && -s "$cache" ]]; then
 | 
				
			||||||
        echo "Caching $1"
 | 
					        echo "Caching $1"
 | 
				
			||||||
        $@ > "$cache" 2> /dev/null
 | 
					        $@ > "$cache" 2> /dev/null
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue